fdwatch.h

来自「非常优秀的linux嵌入式http服务器」· C头文件 代码 · 共 22 行

H
22
字号
/* fdwatch.h - header file for fdwatch package**** This package abstracts the use of the select()/poll()/kqueue()** 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.**** 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 + -
显示快捷键?