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

Comparing libev/ev.pod (file contents):
Revision 1.241 by root, Sat Apr 25 14:23:26 2009 UTC vs.
Revision 1.242 by root, Thu Jun 18 18:16:54 2009 UTC

1184 #include <stddef.h> 1184 #include <stddef.h>
1185 1185
1186 static void 1186 static void
1187 t1_cb (EV_P_ ev_timer *w, int revents) 1187 t1_cb (EV_P_ ev_timer *w, int revents)
1188 { 1188 {
1189 struct my_biggy big = (struct my_biggy * 1189 struct my_biggy big = (struct my_biggy *)
1190 (((char *)w) - offsetof (struct my_biggy, t1)); 1190 (((char *)w) - offsetof (struct my_biggy, t1));
1191 } 1191 }
1192 1192
1193 static void 1193 static void
1194 t2_cb (EV_P_ ev_timer *w, int revents) 1194 t2_cb (EV_P_ ev_timer *w, int revents)
1195 { 1195 {
1196 struct my_biggy big = (struct my_biggy * 1196 struct my_biggy big = (struct my_biggy *)
1197 (((char *)w) - offsetof (struct my_biggy, t2)); 1197 (((char *)w) - offsetof (struct my_biggy, t2));
1198 } 1198 }
1199 1199
1200=head2 WATCHER PRIORITY MODELS 1200=head2 WATCHER PRIORITY MODELS
1201 1201
1277 // with the default priority are receiving events. 1277 // with the default priority are receiving events.
1278 ev_idle_start (EV_A_ &idle); 1278 ev_idle_start (EV_A_ &idle);
1279 } 1279 }
1280 1280
1281 static void 1281 static void
1282 idle-cb (EV_P_ ev_idle *w, int revents) 1282 idle_cb (EV_P_ ev_idle *w, int revents)
1283 { 1283 {
1284 // actual processing 1284 // actual processing
1285 read (STDIN_FILENO, ...); 1285 read (STDIN_FILENO, ...);
1286 1286
1287 // have to start the I/O watcher again, as 1287 // have to start the I/O watcher again, as
2368 // no longer anything immediate to do. 2368 // no longer anything immediate to do.
2369 } 2369 }
2370 2370
2371 ev_idle *idle_watcher = malloc (sizeof (ev_idle)); 2371 ev_idle *idle_watcher = malloc (sizeof (ev_idle));
2372 ev_idle_init (idle_watcher, idle_cb); 2372 ev_idle_init (idle_watcher, idle_cb);
2373 ev_idle_start (loop, idle_cb); 2373 ev_idle_start (loop, idle_watcher);
2374 2374
2375 2375
2376=head2 C<ev_prepare> and C<ev_check> - customise your event loop! 2376=head2 C<ev_prepare> and C<ev_check> - customise your event loop!
2377 2377
2378Prepare and check watchers are usually (but not always) used in pairs: 2378Prepare and check watchers are usually (but not always) used in pairs:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines