summaryrefslogtreecommitdiff
path: root/ev.h
diff options
context:
space:
mode:
authorMarc Alexander Lehmann <libev@schmorp.de>2015-04-21 10:10:57 +0000
committerMarc Alexander Lehmann <libev@schmorp.de>2015-04-21 10:10:57 +0000
commitc829e39d31e24d3cad24d7dd75e4a013b8d5355e (patch)
tree59da19fad1e6d11f3306c331e8ff6a72fd8eb8a1 /ev.h
parent33ad8a2c56cfdaa98de9e0e188d8ce227047d4ce (diff)
downloadlibev-c829e39d31e24d3cad24d7dd75e4a013b8d5355e.tar.gz
libev-c829e39d31e24d3cad24d7dd75e4a013b8d5355e.zip
*** empty log message ***
Diffstat (limited to 'ev.h')
-rw-r--r--ev.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/ev.h b/ev.h
index 05e5eb3..1bc0cec 100644
--- a/ev.h
+++ b/ev.h
@@ -1,7 +1,7 @@
/*
* libev native API header
*
- * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
@@ -152,6 +152,8 @@ EV_CPP(extern "C" {)
typedef double ev_tstamp;
+#include <string.h> /* for memmove */
+
#ifndef EV_ATOMIC_T
# include <signal.h>
# define EV_ATOMIC_T sig_atomic_t volatile
@@ -719,7 +721,8 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
#define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
-#define ev_cb(ev) (ev)->cb /* rw */
+#define ev_cb_(ev) (ev)->cb /* rw */
+#define ev_cb(ev) (memmove (&ev_cb_ (ev), &((ev_watcher *)(ev))->cb, sizeof (ev_cb_ (ev))), (ev)->cb)
#if EV_MINPRI == EV_MAXPRI
# define ev_priority(ev) ((ev), EV_MINPRI)
@@ -732,7 +735,7 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
#define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at)
#ifndef ev_set_cb
-# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
+# define ev_set_cb(ev,cb_) (ev_cb_ (ev) = (cb_), memmove (&((ev_watcher *)(ev))->cb, &ev_cb_ (ev), sizeof (ev_cb_ (ev))))
#endif
/* stopping (enabling, adding) a watcher does nothing if it is already running */