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

Comparing libev/ev.h (file contents):
Revision 1.168 by root, Wed Apr 18 06:06:04 2012 UTC vs.
Revision 1.181 by root, Mon Jan 19 16:45:19 2015 UTC

40#ifndef EV_H_ 40#ifndef EV_H_
41#define EV_H_ 41#define EV_H_
42 42
43#ifdef __cplusplus 43#ifdef __cplusplus
44# define EV_CPP(x) x 44# define EV_CPP(x) x
45# if __cplusplus >= 201103L
46# define EV_THROW noexcept
47# else
48# define EV_THROW throw ()
49# endif
45#else 50#else
46# define EV_CPP(x) 51# define EV_CPP(x)
52# define EV_THROW
47#endif 53#endif
48
49#define EV_THROW EV_CPP(throw())
50 54
51EV_CPP(extern "C" {) 55EV_CPP(extern "C" {)
52 56
53/*****************************************************************************/ 57/*****************************************************************************/
54 58
203#endif 207#endif
204 208
205/*****************************************************************************/ 209/*****************************************************************************/
206 210
207#define EV_VERSION_MAJOR 4 211#define EV_VERSION_MAJOR 4
208#define EV_VERSION_MINOR 11 212#define EV_VERSION_MINOR 19
209 213
210/* eventmask, revents, events... */ 214/* eventmask, revents, events... */
211enum { 215enum {
212 EV_UNDEF = 0xFFFFFFFF, /* guaranteed to be invalid */ 216 EV_UNDEF = (int)0xFFFFFFFF, /* guaranteed to be invalid */
213 EV_NONE = 0x00, /* no events */ 217 EV_NONE = 0x00, /* no events */
214 EV_READ = 0x01, /* ev_io detected read will not block */ 218 EV_READ = 0x01, /* ev_io detected read will not block */
215 EV_WRITE = 0x02, /* ev_io detected write will not block */ 219 EV_WRITE = 0x02, /* ev_io detected write will not block */
216 EV__IOFDSET = 0x80, /* internal use only */ 220 EV__IOFDSET = 0x80, /* internal use only */
217 EV_IO = EV_READ, /* alias for type-detection */ 221 EV_IO = EV_READ, /* alias for type-detection */
218 EV_TIMER = 0x00000100, /* timer timed out */ 222 EV_TIMER = 0x00000100, /* timer timed out */
219#if EV_COMPAT3 223#if EV_COMPAT3
220 EV_TIMEOUT = EV_TIMER, /* pre 4.0 API compatibility */ 224 EV_TIMEOUT = EV_TIMER, /* pre 4.0 API compatibility */
221#endif 225#endif
222 EV_PERIODIC = 0x00000200, /* periodic timer timed out */ 226 EV_PERIODIC = 0x00000200, /* periodic timer timed out */
223 EV_SIGNAL = 0x00000400, /* signal was received */ 227 EV_SIGNAL = 0x00000400, /* signal was received */
224 EV_CHILD = 0x00000800, /* child/pid had status change */ 228 EV_CHILD = 0x00000800, /* child/pid had status change */
225 EV_STAT = 0x00001000, /* stat data changed */ 229 EV_STAT = 0x00001000, /* stat data changed */
226 EV_IDLE = 0x00002000, /* event loop is idling */ 230 EV_IDLE = 0x00002000, /* event loop is idling */
227 EV_PREPARE = 0x00004000, /* event loop about to poll */ 231 EV_PREPARE = 0x00004000, /* event loop about to poll */
228 EV_CHECK = 0x00008000, /* event loop finished poll */ 232 EV_CHECK = 0x00008000, /* event loop finished poll */
229 EV_EMBED = 0x00010000, /* embedded event loop needs sweep */ 233 EV_EMBED = 0x00010000, /* embedded event loop needs sweep */
230 EV_FORK = 0x00020000, /* event loop resumed in child */ 234 EV_FORK = 0x00020000, /* event loop resumed in child */
231 EV_CLEANUP = 0x00040000, /* event loop resumed in child */ 235 EV_CLEANUP = 0x00040000, /* event loop resumed in child */
232 EV_ASYNC = 0x00080000, /* async intra-loop signal */ 236 EV_ASYNC = 0x00080000, /* async intra-loop signal */
233 EV_CUSTOM = 0x01000000, /* for use by user code */ 237 EV_CUSTOM = 0x01000000, /* for use by user code */
234 EV_ERROR = 0x80000000 /* sent when an error occurs */ 238 EV_ERROR = (int)0x80000000 /* sent when an error occurs */
235}; 239};
236 240
237/* can be used to add custom fields to all watchers, while losing binary compatibility */ 241/* can be used to add custom fields to all watchers, while losing binary compatibility */
238#ifndef EV_COMMON 242#ifndef EV_COMMON
239# define EV_COMMON void *data; 243# define EV_COMMON void *data;
593} 597}
594 598
595#endif /* multiplicity */ 599#endif /* multiplicity */
596 600
597/* destroy event loops, also works for the default loop */ 601/* destroy event loops, also works for the default loop */
598EV_API_DECL void ev_loop_destroy (EV_P) EV_THROW; 602EV_API_DECL void ev_loop_destroy (EV_P);
599 603
600/* this needs to be called after fork, to duplicate the loop */ 604/* this needs to be called after fork, to duplicate the loop */
601/* when you want to re-use it in the child */ 605/* when you want to re-use it in the child */
602/* you can call it in either the parent or the child */ 606/* you can call it in either the parent or the child */
603/* you can actually call it at any time, anywhere :) */ 607/* you can actually call it at any time, anywhere :) */
656EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */ 660EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */
657 661
658/* advanced stuff for threading etc. support, see docs */ 662/* advanced stuff for threading etc. support, see docs */
659EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW; 663EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW;
660EV_API_DECL void *ev_userdata (EV_P) EV_THROW; 664EV_API_DECL void *ev_userdata (EV_P) EV_THROW;
665typedef void (*ev_loop_callback)(EV_P);
661EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P)) EV_THROW; 666EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW;
667/* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out */
662EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P) EV_THROW) EV_THROW; 668EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW;
663 669
664EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */ 670EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */
665EV_API_DECL void ev_invoke_pending (EV_P); /* invoke all pending watchers */ 671EV_API_DECL void ev_invoke_pending (EV_P); /* invoke all pending watchers */
666 672
667/* 673/*
728#ifndef ev_set_cb 734#ifndef ev_set_cb
729# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_) 735# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
730#endif 736#endif
731 737
732/* stopping (enabling, adding) a watcher does nothing if it is already running */ 738/* stopping (enabling, adding) a watcher does nothing if it is already running */
733/* stopping (disabling, deleting) a watcher does nothing unless its already running */ 739/* stopping (disabling, deleting) a watcher does nothing unless it's already running */
734#if EV_PROTOTYPES 740#if EV_PROTOTYPES
735 741
736/* feeds an event into a watcher as if the event actually occurred */ 742/* feeds an event into a watcher as if the event actually occurred */
737/* accepts any ev_watcher type */ 743/* accepts any ev_watcher type */
738EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents) EV_THROW; 744EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents) EV_THROW;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines