0
点赞
收藏
分享

微信扫一扫

成为Java开发高手:掌握Spring框架的关键技能-DI

夜空一星 2023-12-05 阅读 47

接口文档的阅读,一定要仔细。最近遇到一个问题,明明文档里有说,read函数读取到的是一个或者多个events,但是代码里依然按照一个来处理。就会导致漏event的可能。漏了event,后续的逻辑就会受影响。
Each successful read(2) returns a buffer containing one or more of the following

structures:
           struct inotify_event {
               int      wd;       /* Watch descriptor */
               uint32_t mask;     /* Mask describing event */
               uint32_t cookie;   /* Unique cookie associating related
                                     events (for rename(2)) */
               uint32_t len;      /* Size of name field */
               char     name[];   /* Optional null-terminated name */
           };

wd identifies the watch for which this event occurs. It is one of the watch descriptors returned by a previous call to inotify_add_watch(2).

这种读文档不仔细的例子,之前还碰到过一两次。有可能大家只是用,从来不读帮助手册,这是不可取的。

举报

相关推荐

0 条评论