summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2008-09-13 18:25:50 +0000
committerroot <root>2008-09-13 18:25:50 +0000
commitc49b0fe38ca566c4494ba31d46ba2015124ae098 (patch)
tree584625e6222ad26a6ed31ff6631e0feec8372653
parentdafe1af050d0634b467b94369ffc99b239a59fe6 (diff)
*** empty log message ***
-rw-r--r--Changes1
-rw-r--r--ev.pod16
2 files changed, 12 insertions, 5 deletions
diff --git a/Changes b/Changes
index 4fa66ef..eddbe61 100644
--- a/Changes
+++ b/Changes
@@ -4,6 +4,7 @@ WISH? monotonic clocks times/GetTickCount for coarse corrections?
3.44
- new function: ev_now_update (loop).
- verify_watcher was not marked static.
+ - improve the "associating..." manpage section.
3.43 Sun Jul 6 05:34:41 CEST 2008
- include more include files on windows to get struct _stati64
diff --git a/ev.pod b/ev.pod
index 1c6c94a..55c78b0 100644
--- a/ev.pod
+++ b/ev.pod
@@ -1008,7 +1008,11 @@ data:
int otherfd;
void *somedata;
struct whatever *mostinteresting;
- }
+ };
+
+ ...
+ struct my_io w;
+ ev_io_init (&w.io, my_cb, fd, EV_READ);
And since your callback will be called with a pointer to the watcher, you
can cast it back to your own type:
@@ -1022,8 +1026,8 @@ can cast it back to your own type:
More interesting and less C-conformant ways of casting your callback type
instead have been omitted.
-Another common scenario is having some data structure with multiple
-watchers:
+Another common scenario is to use some data structure with multiple
+embedded watchers:
struct my_biggy
{
@@ -1032,8 +1036,10 @@ watchers:
ev_timer t2;
}
-In this case getting the pointer to C<my_biggy> is a bit more complicated,
-you need to use C<offsetof>:
+In this case getting the pointer to C<my_biggy> is a bit more
+complicated: Either you store the address of your C<my_biggy> struct
+in the C<data> member of the watcher, or you need to use some pointer
+arithmetic using C<offsetof> inside your watchers:
#include <stddef.h>