fdwatch.h

来自「MiniWeb 在嵌入式平台上运行的WEB源代码」· C头文件 代码 · 共 26 行

H
26
字号
/* fdwatch.h - header file for fdwatch package**** This package abstracts the use of the select() and/or poll() system** calls.  The basic function of these calls is to watch a set of** file descriptors for activity.  select() originated in the BSD world,** while poll() came from SysV land, and their interfaces are somewhat** different.  fdwatch lets you write your code to a single interface,** with the portability differences hidden inside the package.**** Furthermore, if your system implements both select() and poll(),** then fdwatch will use whichever call is most advantageous.  It may** actually switch back and forth at runtime, as the workload changes.**** Usage is fairly simple.  Call fdwatch_get_nfiles() to initialize** the package and find out how many fine descriptors are available.** Then each time through your main loop, call fdwatch_clear(), then** fdwatch_add_fd() for each of the descriptors you want to watch,** then call fdwatch() to actually perform the watch.  After it returns** you can check which descriptors are ready via fdwatch_check_fd().**** If your descriptor set hasn't changed from the last time through** the loop, you can skip calling fdwatch_clear() and fdwatch_add_fd()** to save a little CPU time.****** Copyright 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?