ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.h
(Generate patch)

Comparing libev/ev.h (file contents):
Revision 1.72 by root, Tue Nov 27 10:59:11 2007 UTC vs.
Revision 1.74 by root, Wed Nov 28 11:15:55 2007 UTC

64# define EV_EMBED_ENABLE 1 64# define EV_EMBED_ENABLE 1
65#endif 65#endif
66 66
67/*****************************************************************************/ 67/*****************************************************************************/
68 68
69#include <stddef.h> /* for size_t */
70
69#if EV_STAT_ENABLE 71#if EV_STAT_ENABLE
70# include <sys/stat.h> 72# include <sys/stat.h>
71#endif 73#endif
72 74
73/* support multiple event loops? */ 75/* support multiple event loops? */
216 int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */ 218 int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */
217} ev_child; 219} ev_child;
218 220
219#if EV_STAT_ENABLE 221#if EV_STAT_ENABLE
220/* st_nlink = 0 means missing file or other error */ 222/* st_nlink = 0 means missing file or other error */
221#ifdef _WIN32 223# ifdef _WIN32
222typedef struct _stati64 ev_statdata; 224typedef struct _stati64 ev_statdata;
223#else 225# else
224typedef struct stat ev_statdata; 226typedef struct stat ev_statdata;
225#endif 227# endif
226 228
227/* invoked each time the stat data changes for a given path */ 229/* invoked each time the stat data changes for a given path */
228/* revent EV_STAT */ 230/* revent EV_STAT */
229typedef struct ev_stat 231typedef struct ev_stat
230{ 232{
231 EV_WATCHER (ev_stat) 233 EV_WATCHER_LIST (ev_stat)
232 234
233 ev_timer timer; /* private */ 235 ev_timer timer; /* private */
234 ev_tstamp interval; /* ro */ 236 ev_tstamp interval; /* ro */
235 const char *path; /* ro */ 237 const char *path; /* ro */
236 ev_statdata prev; /* ro */ 238 ev_statdata prev; /* ro */
237 ev_statdata attr; /* ro */ 239 ev_statdata attr; /* ro */
240
241 int wd; /* wd for inotify, fd for kqueue */
238} ev_stat; 242} ev_stat;
239#endif 243#endif
240 244
241/* invoked when the nothing else needs to be done, keeps the process from blocking */ 245/* invoked when the nothing else needs to be done, keeps the process from blocking */
242/* revent EV_IDLE */ 246/* revent EV_IDLE */
332 * It is used to allocate and free memory. 336 * It is used to allocate and free memory.
333 * If it returns zero when memory needs to be allocated, the library might abort 337 * If it returns zero when memory needs to be allocated, the library might abort
334 * or take some potentially destructive action. 338 * or take some potentially destructive action.
335 * The default is your system realloc function. 339 * The default is your system realloc function.
336 */ 340 */
337void ev_set_allocator (void *(*cb)(void *ptr, long size)); 341void ev_set_allocator (void *(*cb)(void *ptr, size_t size));
338 342
339/* set the callback function to call on a 343/* set the callback function to call on a
340 * retryable syscall error 344 * retryable syscall error
341 * (such as failed select, poll, epoll_wait) 345 * (such as failed select, poll, epoll_wait)
342 */ 346 */
422#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0) 426#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0)
423#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0) 427#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0)
424#define ev_periodic_set(ev,at_,ival_,res_) do { (ev)->at = (at_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0) 428#define ev_periodic_set(ev,at_,ival_,res_) do { (ev)->at = (at_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0)
425#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0) 429#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0)
426#define ev_child_set(ev,pid_) do { (ev)->pid = (pid_); } while (0) 430#define ev_child_set(ev,pid_) do { (ev)->pid = (pid_); } while (0)
427#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); } while (0) 431#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); (ev)->wd = -2; } while (0)
428#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */ 432#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */
429#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */ 433#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */
430#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */ 434#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */
431#define ev_embed_set(ev,loop_) do { (ev)->loop = (loop_); } while (0) 435#define ev_embed_set(ev,loop_) do { (ev)->loop = (loop_); } while (0)
432#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */ 436#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines