summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2012-04-18 05:44:42 +0000
committerroot <root>2012-04-18 05:44:42 +0000
commitbd0daf820afeebbc6a9e4602258ac8bfdb746e28 (patch)
tree796306d901314f1fc0cf9e43046bdcf0ddacef8e
parent31cb3c196903b5e593525f3fb49145b09ed6d9af (diff)
preliminary throw() support
-rw-r--r--Changes1
-rw-r--r--ev.c146
-rw-r--r--ev.h152
3 files changed, 151 insertions, 148 deletions
diff --git a/Changes b/Changes
index 0ad6023..9aea67e 100644
--- a/Changes
+++ b/Changes
@@ -6,6 +6,7 @@ TODO: EV_STANDALONE == NO_HASSEL (do not use clock_gettime in ev_standalone)
TODO: document WSA_EV_USE_SOCKET in win32 part
TODO: ^ OR use WSASend/WSARecv on the handle, which always works
TODO: throw() for most ev.h functions
+TODO: assert on fd watcher linked list pointint to itself
- fix event_base_loop return code, add event_get_callback, event_base_new,
event_base_get_method calls to improve libevent 1.x emulation and add
some libevent 2.x funcitonality (based on a patch by Jeff Davey).
diff --git a/ev.c b/ev.c
index 3181a2e..2297940 100644
--- a/ev.c
+++ b/ev.c
@@ -1107,10 +1107,10 @@ ev_printerr (const char *msg)
}
#endif
-static void (*syserr_cb)(const char *msg);
+static void (*syserr_cb)(const char *msg) EV_THROW;
void ecb_cold
-ev_set_syserr_cb (void (*cb)(const char *msg))
+ev_set_syserr_cb (void (*cb)(const char *msg)) EV_THROW
{
syserr_cb = cb;
}
@@ -1156,10 +1156,10 @@ ev_realloc_emul (void *ptr, long size)
#endif
}
-static void *(*alloc)(void *ptr, long size) = ev_realloc_emul;
+static void *(*alloc)(void *ptr, long size) EV_THROW = ev_realloc_emul;
void ecb_cold
-ev_set_allocator (void *(*cb)(void *ptr, long size))
+ev_set_allocator (void *(*cb)(void *ptr, long size)) EV_THROW
{
alloc = cb;
}
@@ -1286,7 +1286,7 @@ typedef struct
#ifndef EV_HAVE_EV_TIME
ev_tstamp
-ev_time (void)
+ev_time (void) EV_THROW
{
#if EV_USE_REALTIME
if (expect_true (have_realtime))
@@ -1320,14 +1320,14 @@ get_clock (void)
#if EV_MULTIPLICITY
ev_tstamp
-ev_now (EV_P)
+ev_now (EV_P) EV_THROW
{
return ev_rt_now;
}
#endif
void
-ev_sleep (ev_tstamp delay)
+ev_sleep (ev_tstamp delay) EV_THROW
{
if (delay > 0.)
{
@@ -1418,7 +1418,7 @@ pendingcb (EV_P_ ev_prepare *w, int revents)
}
void noinline
-ev_feed_event (EV_P_ void *w, int revents)
+ev_feed_event (EV_P_ void *w, int revents) EV_THROW
{
W w_ = (W)w;
int pri = ABSPRI (w_);
@@ -1487,7 +1487,7 @@ fd_event (EV_P_ int fd, int revents)
}
void
-ev_feed_fd_event (EV_P_ int fd, int revents)
+ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW
{
if (fd >= 0 && fd < anfdmax)
fd_event_nocheck (EV_A_ fd, revents);
@@ -1943,7 +1943,7 @@ pipecb (EV_P_ ev_io *iow, int revents)
/*****************************************************************************/
void
-ev_feed_signal (int signum)
+ev_feed_signal (int signum) EV_THROW
{
#if EV_MULTIPLICITY
EV_P = signals [signum - 1].loop;
@@ -1970,7 +1970,7 @@ ev_sighandler (int signum)
}
void noinline
-ev_feed_signal_event (EV_P_ int signum)
+ev_feed_signal_event (EV_P_ int signum) EV_THROW
{
WL w;
@@ -2096,13 +2096,13 @@ childcb (EV_P_ ev_signal *sw, int revents)
#endif
int ecb_cold
-ev_version_major (void)
+ev_version_major (void) EV_THROW
{
return EV_VERSION_MAJOR;
}
int ecb_cold
-ev_version_minor (void)
+ev_version_minor (void) EV_THROW
{
return EV_VERSION_MINOR;
}
@@ -2120,7 +2120,7 @@ enable_secure (void)
}
unsigned int ecb_cold
-ev_supported_backends (void)
+ev_supported_backends (void) EV_THROW
{
unsigned int flags = 0;
@@ -2134,7 +2134,7 @@ ev_supported_backends (void)
}
unsigned int ecb_cold
-ev_recommended_backends (void)
+ev_recommended_backends (void) EV_THROW
{
unsigned int flags = ev_supported_backends ();
@@ -2156,7 +2156,7 @@ ev_recommended_backends (void)
}
unsigned int ecb_cold
-ev_embeddable_backends (void)
+ev_embeddable_backends (void) EV_THROW
{
int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT;
@@ -2168,56 +2168,56 @@ ev_embeddable_backends (void)
}
unsigned int
-ev_backend (EV_P)
+ev_backend (EV_P) EV_THROW
{
return backend;
}
#if EV_FEATURE_API
unsigned int
-ev_iteration (EV_P)
+ev_iteration (EV_P) EV_THROW
{
return loop_count;
}
unsigned int
-ev_depth (EV_P)
+ev_depth (EV_P) EV_THROW
{
return loop_depth;
}
void
-ev_set_io_collect_interval (EV_P_ ev_tstamp interval)
+ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW
{
io_blocktime = interval;
}
void
-ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval)
+ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW
{
timeout_blocktime = interval;
}
void
-ev_set_userdata (EV_P_ void *data)
+ev_set_userdata (EV_P_ void *data) EV_THROW
{
userdata = data;
}
void *
-ev_userdata (EV_P)
+ev_userdata (EV_P) EV_THROW
{
return userdata;
}
void
-ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P))
+ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P)) EV_THROW
{
invoke_cb = invoke_pending_cb;
}
void
-ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P))
+ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P)) EV_THROW
{
release_cb = release;
acquire_cb = acquire;
@@ -2226,7 +2226,7 @@ ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P))
/* initialise a loop structure, must be zero-initialised */
static void noinline ecb_cold
-loop_init (EV_P_ unsigned int flags)
+loop_init (EV_P_ unsigned int flags) EV_THROW
{
if (!backend)
{
@@ -2321,7 +2321,7 @@ loop_init (EV_P_ unsigned int flags)
/* free up a loop structure */
void ecb_cold
-ev_loop_destroy (EV_P)
+ev_loop_destroy (EV_P) EV_THROW
{
int i;
@@ -2489,7 +2489,7 @@ loop_fork (EV_P)
#if EV_MULTIPLICITY
struct ev_loop * ecb_cold
-ev_loop_new (unsigned int flags)
+ev_loop_new (unsigned int flags) EV_THROW
{
EV_P = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop));
@@ -2543,7 +2543,7 @@ array_verify (EV_P_ W *ws, int cnt)
#if EV_FEATURE_API
void ecb_cold
-ev_verify (EV_P)
+ev_verify (EV_P) EV_THROW
{
#if EV_VERIFY
int i;
@@ -2622,7 +2622,7 @@ struct ev_loop * ecb_cold
#else
int
#endif
-ev_default_loop (unsigned int flags)
+ev_default_loop (unsigned int flags) EV_THROW
{
if (!ev_default_loop_ptr)
{
@@ -2651,7 +2651,7 @@ ev_default_loop (unsigned int flags)
}
void
-ev_loop_fork (EV_P)
+ev_loop_fork (EV_P) EV_THROW
{
postfork = 1; /* must be in line with ev_default_fork */
}
@@ -2665,7 +2665,7 @@ ev_invoke (EV_P_ void *w, int revents)
}
unsigned int
-ev_pending_count (EV_P)
+ev_pending_count (EV_P) EV_THROW
{
int pri;
unsigned int count = 0;
@@ -3106,37 +3106,37 @@ ev_run (EV_P_ int flags)
}
void
-ev_break (EV_P_ int how)
+ev_break (EV_P_ int how) EV_THROW
{
loop_done = how;
}
void
-ev_ref (EV_P)
+ev_ref (EV_P) EV_THROW
{
++activecnt;
}
void
-ev_unref (EV_P)
+ev_unref (EV_P) EV_THROW
{
--activecnt;
}
void
-ev_now_update (EV_P)
+ev_now_update (EV_P) EV_THROW
{
time_update (EV_A_ 1e100);
}
void
-ev_suspend (EV_P)
+ev_suspend (EV_P) EV_THROW
{
ev_now_update (EV_A);
}
void
-ev_resume (EV_P)
+ev_resume (EV_P) EV_THROW
{
ev_tstamp mn_prev = mn_now;
@@ -3185,7 +3185,7 @@ clear_pending (EV_P_ W w)
}
int
-ev_clear_pending (EV_P_ void *w)
+ev_clear_pending (EV_P_ void *w) EV_THROW
{
W w_ = (W)w;
int pending = w_->pending;
@@ -3228,7 +3228,7 @@ ev_stop (EV_P_ W w)
/*****************************************************************************/
void noinline
-ev_io_start (EV_P_ ev_io *w)
+ev_io_start (EV_P_ ev_io *w) EV_THROW
{
int fd = w->fd;
@@ -3251,7 +3251,7 @@ ev_io_start (EV_P_ ev_io *w)
}
void noinline
-ev_io_stop (EV_P_ ev_io *w)
+ev_io_stop (EV_P_ ev_io *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3270,7 +3270,7 @@ ev_io_stop (EV_P_ ev_io *w)
}
void noinline
-ev_timer_start (EV_P_ ev_timer *w)
+ev_timer_start (EV_P_ ev_timer *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -3294,7 +3294,7 @@ ev_timer_start (EV_P_ ev_timer *w)
}
void noinline
-ev_timer_stop (EV_P_ ev_timer *w)
+ev_timer_stop (EV_P_ ev_timer *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3324,7 +3324,7 @@ ev_timer_stop (EV_P_ ev_timer *w)
}
void noinline
-ev_timer_again (EV_P_ ev_timer *w)
+ev_timer_again (EV_P_ ev_timer *w) EV_THROW
{
EV_FREQUENT_CHECK;
@@ -3351,14 +3351,14 @@ ev_timer_again (EV_P_ ev_timer *w)
}
ev_tstamp
-ev_timer_remaining (EV_P_ ev_timer *w)
+ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW
{
return ev_at (w) - (ev_is_active (w) ? mn_now : 0.);
}
#if EV_PERIODIC_ENABLE
void noinline
-ev_periodic_start (EV_P_ ev_periodic *w)
+ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -3388,7 +3388,7 @@ ev_periodic_start (EV_P_ ev_periodic *w)
}
void noinline
-ev_periodic_stop (EV_P_ ev_periodic *w)
+ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3416,7 +3416,7 @@ ev_periodic_stop (EV_P_ ev_periodic *w)
}
void noinline
-ev_periodic_again (EV_P_ ev_periodic *w)
+ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW
{
/* TODO: use adjustheap and recalculation */
ev_periodic_stop (EV_A_ w);
@@ -3431,7 +3431,7 @@ ev_periodic_again (EV_P_ ev_periodic *w)
#if EV_SIGNAL_ENABLE
void noinline
-ev_signal_start (EV_P_ ev_signal *w)
+ev_signal_start (EV_P_ ev_signal *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -3512,7 +3512,7 @@ ev_signal_start (EV_P_ ev_signal *w)
}
void noinline
-ev_signal_stop (EV_P_ ev_signal *w)
+ev_signal_stop (EV_P_ ev_signal *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3553,7 +3553,7 @@ ev_signal_stop (EV_P_ ev_signal *w)
#if EV_CHILD_ENABLE
void
-ev_child_start (EV_P_ ev_child *w)
+ev_child_start (EV_P_ ev_child *w) EV_THROW
{
#if EV_MULTIPLICITY
assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
@@ -3570,7 +3570,7 @@ ev_child_start (EV_P_ ev_child *w)
}
void
-ev_child_stop (EV_P_ ev_child *w)
+ev_child_stop (EV_P_ ev_child *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3832,7 +3832,7 @@ infy_fork (EV_P)
#endif
void
-ev_stat_stat (EV_P_ ev_stat *w)
+ev_stat_stat (EV_P_ ev_stat *w) EV_THROW
{
if (lstat (w->path, &w->attr) < 0)
w->attr.st_nlink = 0;
@@ -3881,7 +3881,7 @@ stat_timer_cb (EV_P_ ev_timer *w_, int revents)
}
void
-ev_stat_start (EV_P_ ev_stat *w)
+ev_stat_start (EV_P_ ev_stat *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -3912,7 +3912,7 @@ ev_stat_start (EV_P_ ev_stat *w)
}
void
-ev_stat_stop (EV_P_ ev_stat *w)
+ev_stat_stop (EV_P_ ev_stat *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3938,7 +3938,7 @@ ev_stat_stop (EV_P_ ev_stat *w)
#if EV_IDLE_ENABLE
void
-ev_idle_start (EV_P_ ev_idle *w)
+ev_idle_start (EV_P_ ev_idle *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -3961,7 +3961,7 @@ ev_idle_start (EV_P_ ev_idle *w)
}
void
-ev_idle_stop (EV_P_ ev_idle *w)
+ev_idle_stop (EV_P_ ev_idle *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -3985,7 +3985,7 @@ ev_idle_stop (EV_P_ ev_idle *w)
#if EV_PREPARE_ENABLE
void
-ev_prepare_start (EV_P_ ev_prepare *w)
+ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -4000,7 +4000,7 @@ ev_prepare_start (EV_P_ ev_prepare *w)
}
void
-ev_prepare_stop (EV_P_ ev_prepare *w)
+ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -4023,7 +4023,7 @@ ev_prepare_stop (EV_P_ ev_prepare *w)
#if EV_CHECK_ENABLE
void
-ev_check_start (EV_P_ ev_check *w)
+ev_check_start (EV_P_ ev_check *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -4038,7 +4038,7 @@ ev_check_start (EV_P_ ev_check *w)
}
void
-ev_check_stop (EV_P_ ev_check *w)
+ev_check_stop (EV_P_ ev_check *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -4061,7 +4061,7 @@ ev_check_stop (EV_P_ ev_check *w)
#if EV_EMBED_ENABLE
void noinline
-ev_embed_sweep (EV_P_ ev_embed *w)
+ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW
{
ev_run (w->other, EVRUN_NOWAIT);
}
@@ -4119,7 +4119,7 @@ embed_idle_cb (EV_P_ ev_idle *idle, int revents)
#endif
void
-ev_embed_start (EV_P_ ev_embed *w)
+ev_embed_start (EV_P_ ev_embed *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -4150,7 +4150,7 @@ ev_embed_start (EV_P_ ev_embed *w)
}
void
-ev_embed_stop (EV_P_ ev_embed *w)
+ev_embed_stop (EV_P_ ev_embed *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -4170,7 +4170,7 @@ ev_embed_stop (EV_P_ ev_embed *w)
#if EV_FORK_ENABLE
void
-ev_fork_start (EV_P_ ev_fork *w)
+ev_fork_start (EV_P_ ev_fork *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -4185,7 +4185,7 @@ ev_fork_start (EV_P_ ev_fork *w)
}
void
-ev_fork_stop (EV_P_ ev_fork *w)
+ev_fork_stop (EV_P_ ev_fork *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -4208,7 +4208,7 @@ ev_fork_stop (EV_P_ ev_fork *w)
#if EV_CLEANUP_ENABLE
void
-ev_cleanup_start (EV_P_ ev_cleanup *w)
+ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -4225,7 +4225,7 @@ ev_cleanup_start (EV_P_ ev_cleanup *w)
}
void
-ev_cleanup_stop (EV_P_ ev_cleanup *w)
+ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -4249,7 +4249,7 @@ ev_cleanup_stop (EV_P_ ev_cleanup *w)
#if EV_ASYNC_ENABLE
void
-ev_async_start (EV_P_ ev_async *w)
+ev_async_start (EV_P_ ev_async *w) EV_THROW
{
if (expect_false (ev_is_active (w)))
return;
@@ -4268,7 +4268,7 @@ ev_async_start (EV_P_ ev_async *w)
}
void
-ev_async_stop (EV_P_ ev_async *w)
+ev_async_stop (EV_P_ ev_async *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
@@ -4289,7 +4289,7 @@ ev_async_stop (EV_P_ ev_async *w)
}
void
-ev_async_send (EV_P_ ev_async *w)
+ev_async_send (EV_P_ ev_async *w) EV_THROW
{
w->sent = 1;
evpipe_write (EV_A_ &async_pending);
@@ -4336,7 +4336,7 @@ once_cb_to (EV_P_ ev_timer *w, int revents)
}
void
-ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg)
+ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW
{
struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once));
@@ -4368,7 +4368,7 @@ ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, vo
#if EV_WALK_ENABLE
void ecb_cold
-ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w))
+ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW
{
int i, j;
ev_watcher_list *wl, *wn;
diff --git a/ev.h b/ev.h
index 1be861b..1eac206 100644
--- a/ev.h
+++ b/ev.h
@@ -46,6 +46,8 @@
# define EV_CPP(x)
#endif
+#define EV_THROW EV_CPP(throw())
+
EV_CPP(extern "C" {)
/*****************************************************************************/
@@ -518,15 +520,15 @@ enum {
};
#if EV_PROTOTYPES
-EV_API_DECL int ev_version_major (void);
-EV_API_DECL int ev_version_minor (void);
+EV_API_DECL int ev_version_major (void) EV_THROW;
+EV_API_DECL int ev_version_minor (void) EV_THROW;
-EV_API_DECL unsigned int ev_supported_backends (void);
-EV_API_DECL unsigned int ev_recommended_backends (void);
-EV_API_DECL unsigned int ev_embeddable_backends (void);
+EV_API_DECL unsigned int ev_supported_backends (void) EV_THROW;
+EV_API_DECL unsigned int ev_recommended_backends (void) EV_THROW;
+EV_API_DECL unsigned int ev_embeddable_backends (void) EV_THROW;
-EV_API_DECL ev_tstamp ev_time (void);
-EV_API_DECL void ev_sleep (ev_tstamp delay); /* sleep for a while */
+EV_API_DECL ev_tstamp ev_time (void) EV_THROW;
+EV_API_DECL void ev_sleep (ev_tstamp delay) EV_THROW; /* sleep for a while */
/* Sets the allocation function to use, works like realloc.
* It is used to allocate and free memory.
@@ -534,26 +536,26 @@ EV_API_DECL void ev_sleep (ev_tstamp delay); /* sleep for a while */
* or take some potentially destructive action.
* The default is your system realloc function.
*/
-EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size));
+EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_THROW) EV_THROW;
/* set the callback function to call on a
* retryable syscall error
* (such as failed select, poll, epoll_wait)
*/
-EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg));
+EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_THROW) EV_THROW;
#if EV_MULTIPLICITY
/* the default loop is the only one that handles signals and child watchers */
/* you can call this as often as you like */
-EV_API_DECL struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0));
+EV_API_DECL struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_THROW;
#ifdef EV_API_STATIC
EV_API_DECL struct ev_loop *ev_default_loop_ptr;
#endif
EV_INLINE struct ev_loop *
-ev_default_loop_uc_ (void)
+ev_default_loop_uc_ (void) EV_THROW
{
extern struct ev_loop *ev_default_loop_ptr;
@@ -561,31 +563,31 @@ ev_default_loop_uc_ (void)
}
EV_INLINE int
-ev_is_default_loop (EV_P)
+ev_is_default_loop (EV_P) EV_THROW
{
return EV_A == EV_DEFAULT_UC;
}
/* create and destroy alternative loops that don't handle signals */
-EV_API_DECL struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0));
+EV_API_DECL struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)) EV_THROW;
-EV_API_DECL ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
+EV_API_DECL ev_tstamp ev_now (EV_P) EV_THROW; /* time w.r.t. timers and the eventloop, updated after each poll */
#else
-EV_API_DECL int ev_default_loop (unsigned int flags EV_CPP (= 0)); /* returns true when successful */
+EV_API_DECL int ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_THROW; /* returns true when successful */
EV_API_DECL ev_tstamp ev_rt_now;
EV_INLINE ev_tstamp
-ev_now (void)
+ev_now (void) EV_THROW
{
return ev_rt_now;
}
/* looks weird, but ev_is_default_loop (EV_A) still works if this exists */
EV_INLINE int
-ev_is_default_loop (void)
+ev_is_default_loop (void) EV_THROW
{
return 1;
}
@@ -593,23 +595,23 @@ ev_is_default_loop (void)
#endif /* multiplicity */
/* destroy event loops, also works for the default loop */
-EV_API_DECL void ev_loop_destroy (EV_P);
+EV_API_DECL void ev_loop_destroy (EV_P) EV_THROW;
/* this needs to be called after fork, to duplicate the loop */
/* when you want to re-use it in the child */
/* you can call it in either the parent or the child */
/* you can actually call it at any time, anywhere :) */
-EV_API_DECL void ev_loop_fork (EV_P);
+EV_API_DECL void ev_loop_fork (EV_P) EV_THROW;
-EV_API_DECL unsigned int ev_backend (EV_P); /* backend in use by loop */
+EV_API_DECL unsigned int ev_backend (EV_P) EV_THROW; /* backend in use by loop */
-EV_API_DECL void ev_now_update (EV_P); /* update event loop time */
+EV_API_DECL void ev_now_update (EV_P) EV_THROW; /* update event loop time */
#if EV_WALK_ENABLE
/* walk (almost) all watchers in the loop of a given type, invoking the */
/* callback on every such watcher. The callback might stop the watcher, */
/* but do nothing else with the loop */
-EV_API_DECL void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w));
+EV_API_DECL void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW;
#endif
#endif /* prototypes */
@@ -629,44 +631,44 @@ enum {
#if EV_PROTOTYPES
EV_API_DECL int ev_run (EV_P_ int flags EV_CPP (= 0));
-EV_API_DECL void ev_break (EV_P_ int how EV_CPP (= EVBREAK_ONE)); /* break out of the loop */
+EV_API_DECL void ev_break (EV_P_ int how EV_CPP (= EVBREAK_ONE)) EV_THROW; /* break out of the loop */
/*
* ref/unref can be used to add or remove a refcount on the mainloop. every watcher
* keeps one reference. if you have a long-running watcher you never unregister that
* should not keep ev_loop from running, unref() after starting, and ref() before stopping.
*/
-EV_API_DECL void ev_ref (EV_P);
-EV_API_DECL void ev_unref (EV_P);
+EV_API_DECL void ev_ref (EV_P) EV_THROW;
+EV_API_DECL void ev_unref (EV_P) EV_THROW;
/*
* convenience function, wait for a single event, without registering an event watcher
* if timeout is < 0, do wait indefinitely
*/
-EV_API_DECL void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg);
+EV_API_DECL void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW;
# if EV_FEATURE_API
-EV_API_DECL unsigned int ev_iteration (EV_P); /* number of loop iterations */
-EV_API_DECL unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */
-EV_API_DECL void ev_verify (EV_P); /* abort if loop data corrupted */
+EV_API_DECL unsigned int ev_iteration (EV_P) EV_THROW; /* number of loop iterations */
+EV_API_DECL unsigned int ev_depth (EV_P) EV_THROW; /* #ev_loop enters - #ev_loop leaves */
+EV_API_DECL void ev_verify (EV_P) EV_THROW; /* abort if loop data corrupted */
-EV_API_DECL void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
-EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
+EV_API_DECL void ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */
+EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */
/* advanced stuff for threading etc. support, see docs */
-EV_API_DECL void ev_set_userdata (EV_P_ void *data);
-EV_API_DECL void *ev_userdata (EV_P);
-EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P));
-EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P));
+EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW;
+EV_API_DECL void *ev_userdata (EV_P) EV_THROW;
+EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P)) EV_THROW;
+EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P)) EV_THROW;
-EV_API_DECL unsigned int ev_pending_count (EV_P); /* number of pending events, if any */
+EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */
EV_API_DECL void ev_invoke_pending (EV_P); /* invoke all pending watchers */
/*
* stop/start the timer handling.
*/
-EV_API_DECL void ev_suspend (EV_P);
-EV_API_DECL void ev_resume (EV_P);
+EV_API_DECL void ev_suspend (EV_P) EV_THROW;
+EV_API_DECL void ev_resume (EV_P) EV_THROW;
#endif
#endif
@@ -733,85 +735,85 @@ EV_API_DECL void ev_resume (EV_P);
/* feeds an event into a watcher as if the event actually occurred */
/* accepts any ev_watcher type */
-EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents);
-EV_API_DECL void ev_feed_fd_event (EV_P_ int fd, int revents);
+EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents) EV_THROW;
+EV_API_DECL void ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW;
#if EV_SIGNAL_ENABLE
-EV_API_DECL void ev_feed_signal (int signum);
-EV_API_DECL void ev_feed_signal_event (EV_P_ int signum);
+EV_API_DECL void ev_feed_signal (int signum) EV_THROW;
+EV_API_DECL void ev_feed_signal_event (EV_P_ int signum) EV_THROW;
#endif
EV_API_DECL void ev_invoke (EV_P_ void *w, int revents);
-EV_API_DECL int ev_clear_pending (EV_P_ void *w);
+EV_API_DECL int ev_clear_pending (EV_P_ void *w) EV_THROW;
-EV_API_DECL void ev_io_start (EV_P_ ev_io *w);
-EV_API_DECL void ev_io_stop (EV_P_ ev_io *w);
+EV_API_DECL void ev_io_start (EV_P_ ev_io *w) EV_THROW;
+EV_API_DECL void ev_io_stop (EV_P_ ev_io *w) EV_THROW;
-EV_API_DECL void ev_timer_start (EV_P_ ev_timer *w);
-EV_API_DECL void ev_timer_stop (EV_P_ ev_timer *w);
+EV_API_DECL void ev_timer_start (EV_P_ ev_timer *w) EV_THROW;
+EV_API_DECL void ev_timer_stop (EV_P_ ev_timer *w) EV_THROW;
/* stops if active and no repeat, restarts if active and repeating, starts if inactive and repeating */
-EV_API_DECL void ev_timer_again (EV_P_ ev_timer *w);
+EV_API_DECL void ev_timer_again (EV_P_ ev_timer *w) EV_THROW;
/* return remaining time */
-EV_API_DECL ev_tstamp ev_timer_remaining (EV_P_ ev_timer *w);
+EV_API_DECL ev_tstamp ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW;
#if EV_PERIODIC_ENABLE
-EV_API_DECL void ev_periodic_start (EV_P_ ev_periodic *w);
-EV_API_DECL void ev_periodic_stop (EV_P_ ev_periodic *w);
-EV_API_DECL void ev_periodic_again (EV_P_ ev_periodic *w);
+EV_API_DECL void ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW;
+EV_API_DECL void ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW;
+EV_API_DECL void ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW;
#endif
/* only supported in the default loop */
#if EV_SIGNAL_ENABLE
-EV_API_DECL void ev_signal_start (EV_P_ ev_signal *w);
-EV_API_DECL void ev_signal_stop (EV_P_ ev_signal *w);
+EV_API_DECL void ev_signal_start (EV_P_ ev_signal *w) EV_THROW;
+EV_API_DECL void ev_signal_stop (EV_P_ ev_signal *w) EV_THROW;
#endif
/* only supported in the default loop */
# if EV_CHILD_ENABLE
-EV_API_DECL void ev_child_start (EV_P_ ev_child *w);
-EV_API_DECL void ev_child_stop (EV_P_ ev_child *w);
+EV_API_DECL void ev_child_start (EV_P_ ev_child *w) EV_THROW;
+EV_API_DECL void ev_child_stop (EV_P_ ev_child *w) EV_THROW;
# endif
# if EV_STAT_ENABLE
-EV_API_DECL void ev_stat_start (EV_P_ ev_stat *w);
-EV_API_DECL void ev_stat_stop (EV_P_ ev_stat *w);
-EV_API_DECL void ev_stat_stat (EV_P_ ev_stat *w);
+EV_API_DECL void ev_stat_start (EV_P_ ev_stat *w) EV_THROW;
+EV_API_DECL void ev_stat_stop (EV_P_ ev_stat *w) EV_THROW;
+EV_API_DECL void ev_stat_stat (EV_P_ ev_stat *w) EV_THROW;
# endif
# if EV_IDLE_ENABLE
-EV_API_DECL void ev_idle_start (EV_P_ ev_idle *w);
-EV_API_DECL void ev_idle_stop (EV_P_ ev_idle *w);
+EV_API_DECL void ev_idle_start (EV_P_ ev_idle *w) EV_THROW;
+EV_API_DECL void ev_idle_stop (EV_P_ ev_idle *w) EV_THROW;
# endif
#if EV_PREPARE_ENABLE
-EV_API_DECL void ev_prepare_start (EV_P_ ev_prepare *w);
-EV_API_DECL void ev_prepare_stop (EV_P_ ev_prepare *w);
+EV_API_DECL void ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW;
+EV_API_DECL void ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW;
#endif
#if EV_CHECK_ENABLE
-EV_API_DECL void ev_check_start (EV_P_ ev_check *w);
-EV_API_DECL void ev_check_stop (EV_P_ ev_check *w);
+EV_API_DECL void ev_check_start (EV_P_ ev_check *w) EV_THROW;
+EV_API_DECL void ev_check_stop (EV_P_ ev_check *w) EV_THROW;
#endif
# if EV_FORK_ENABLE
-EV_API_DECL void ev_fork_start (EV_P_ ev_fork *w);
-EV_API_DECL void ev_fork_stop (EV_P_ ev_fork *w);
+EV_API_DECL void ev_fork_start (EV_P_ ev_fork *w) EV_THROW;
+EV_API_DECL void ev_fork_stop (EV_P_ ev_fork *w) EV_THROW;
# endif
# if EV_CLEANUP_ENABLE
-EV_API_DECL void ev_cleanup_start (EV_P_ ev_cleanup *w);
-EV_API_DECL void ev_cleanup_stop (EV_P_ ev_cleanup *w);
+EV_API_DECL void ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW;
+EV_API_DECL void ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW;
# endif
# if EV_EMBED_ENABLE
/* only supported when loop to be embedded is in fact embeddable */
-EV_API_DECL void ev_embed_start (EV_P_ ev_embed *w);
-EV_API_DECL void ev_embed_stop (EV_P_ ev_embed *w);
-EV_API_DECL void ev_embed_sweep (EV_P_ ev_embed *w);
+EV_API_DECL void ev_embed_start (EV_P_ ev_embed *w) EV_THROW;
+EV_API_DECL void ev_embed_stop (EV_P_ ev_embed *w) EV_THROW;
+EV_API_DECL void ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW;
# endif
# if EV_ASYNC_ENABLE
-EV_API_DECL void ev_async_start (EV_P_ ev_async *w);
-EV_API_DECL void ev_async_stop (EV_P_ ev_async *w);
-EV_API_DECL void ev_async_send (EV_P_ ev_async *w);
+EV_API_DECL void ev_async_start (EV_P_ ev_async *w) EV_THROW;
+EV_API_DECL void ev_async_stop (EV_P_ ev_async *w) EV_THROW;
+EV_API_DECL void ev_async_send (EV_P_ ev_async *w) EV_THROW;
# endif
#if EV_COMPAT3