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

Comparing libev/ev.pod (file contents):
Revision 1.81 by root, Wed Dec 12 04:53:58 2007 UTC vs.
Revision 1.82 by root, Wed Dec 12 17:55:06 2007 UTC

933This is how one would do it normally anyway, the important point is that 933This is how one would do it normally anyway, the important point is that
934the libev application should not optimise around libev but should leave 934the libev application should not optimise around libev but should leave
935optimisations to libev. 935optimisations to libev.
936 936
937 937
938=head3 Watcher-Specific Functions
939
938=over 4 940=over 4
939 941
940=item ev_io_init (ev_io *, callback, int fd, int events) 942=item ev_io_init (ev_io *, callback, int fd, int events)
941 943
942=item ev_io_set (ev_io *, int fd, int events) 944=item ev_io_set (ev_io *, int fd, int events)
994 ev_timer_set (&timer, after + ev_now () - ev_time (), 0.); 996 ev_timer_set (&timer, after + ev_now () - ev_time (), 0.);
995 997
996The callback is guarenteed to be invoked only when its timeout has passed, 998The callback is guarenteed to be invoked only when its timeout has passed,
997but if multiple timers become ready during the same loop iteration then 999but if multiple timers become ready during the same loop iteration then
998order of execution is undefined. 1000order of execution is undefined.
1001
1002=head3 Watcher-Specific Functions and Data Members
999 1003
1000=over 4 1004=over 4
1001 1005
1002=item ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat) 1006=item ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)
1003 1007
1109 1113
1110As with timers, the callback is guarenteed to be invoked only when the 1114As with timers, the callback is guarenteed to be invoked only when the
1111time (C<at>) has been passed, but if multiple periodic timers become ready 1115time (C<at>) has been passed, but if multiple periodic timers become ready
1112during the same loop iteration then order of execution is undefined. 1116during the same loop iteration then order of execution is undefined.
1113 1117
1118=head3 Watcher-Specific Functions and Data Members
1119
1114=over 4 1120=over 4
1115 1121
1116=item ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb) 1122=item ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb)
1117 1123
1118=item ev_periodic_set (ev_periodic *, ev_tstamp after, ev_tstamp repeat, reschedule_cb) 1124=item ev_periodic_set (ev_periodic *, ev_tstamp after, ev_tstamp repeat, reschedule_cb)
1264with the kernel (thus it coexists with your own signal handlers as long 1270with the kernel (thus it coexists with your own signal handlers as long
1265as you don't register any with libev). Similarly, when the last signal 1271as you don't register any with libev). Similarly, when the last signal
1266watcher for a signal is stopped libev will reset the signal handler to 1272watcher for a signal is stopped libev will reset the signal handler to
1267SIG_DFL (regardless of what it was set to before). 1273SIG_DFL (regardless of what it was set to before).
1268 1274
1275=head3 Watcher-Specific Functions and Data Members
1276
1269=over 4 1277=over 4
1270 1278
1271=item ev_signal_init (ev_signal *, callback, int signum) 1279=item ev_signal_init (ev_signal *, callback, int signum)
1272 1280
1273=item ev_signal_set (ev_signal *, int signum) 1281=item ev_signal_set (ev_signal *, int signum)
1284 1292
1285=head2 C<ev_child> - watch out for process status changes 1293=head2 C<ev_child> - watch out for process status changes
1286 1294
1287Child watchers trigger when your process receives a SIGCHLD in response to 1295Child watchers trigger when your process receives a SIGCHLD in response to
1288some child status changes (most typically when a child of yours dies). 1296some child status changes (most typically when a child of yours dies).
1297
1298=head3 Watcher-Specific Functions and Data Members
1289 1299
1290=over 4 1300=over 4
1291 1301
1292=item ev_child_init (ev_child *, callback, int pid) 1302=item ev_child_init (ev_child *, callback, int pid)
1293 1303
1361reader). Inotify will be used to give hints only and should not change the 1371reader). Inotify will be used to give hints only and should not change the
1362semantics of C<ev_stat> watchers, which means that libev sometimes needs 1372semantics of C<ev_stat> watchers, which means that libev sometimes needs
1363to fall back to regular polling again even with inotify, but changes are 1373to fall back to regular polling again even with inotify, but changes are
1364usually detected immediately, and if the file exists there will be no 1374usually detected immediately, and if the file exists there will be no
1365polling. 1375polling.
1376
1377=head3 Watcher-Specific Functions and Data Members
1366 1378
1367=over 4 1379=over 4
1368 1380
1369=item ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval) 1381=item ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval)
1370 1382
1453Apart from keeping your process non-blocking (which is a useful 1465Apart from keeping your process non-blocking (which is a useful
1454effect on its own sometimes), idle watchers are a good place to do 1466effect on its own sometimes), idle watchers are a good place to do
1455"pseudo-background processing", or delay processing stuff to after the 1467"pseudo-background processing", or delay processing stuff to after the
1456event loop has handled all outstanding events. 1468event loop has handled all outstanding events.
1457 1469
1470=head3 Watcher-Specific Functions and Data Members
1471
1458=over 4 1472=over 4
1459 1473
1460=item ev_idle_init (ev_signal *, callback) 1474=item ev_idle_init (ev_signal *, callback)
1461 1475
1462Initialises and configures the idle watcher - it has no parameters of any 1476Initialises and configures the idle watcher - it has no parameters of any
1529their job. As C<ev_check> watchers are often used to embed other event 1543their job. As C<ev_check> watchers are often used to embed other event
1530loops those other event loops might be in an unusable state until their 1544loops those other event loops might be in an unusable state until their
1531C<ev_check> watcher ran (always remind yourself to coexist peacefully with 1545C<ev_check> watcher ran (always remind yourself to coexist peacefully with
1532others). 1546others).
1533 1547
1548=head3 Watcher-Specific Functions and Data Members
1549
1534=over 4 1550=over 4
1535 1551
1536=item ev_prepare_init (ev_prepare *, callback) 1552=item ev_prepare_init (ev_prepare *, callback)
1537 1553
1538=item ev_check_init (ev_check *, callback) 1554=item ev_check_init (ev_check *, callback)
1739 ev_embed_start (loop_hi, &embed); 1755 ev_embed_start (loop_hi, &embed);
1740 } 1756 }
1741 else 1757 else
1742 loop_lo = loop_hi; 1758 loop_lo = loop_hi;
1743 1759
1760=head3 Watcher-Specific Functions and Data Members
1761
1744=over 4 1762=over 4
1745 1763
1746=item ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop) 1764=item ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)
1747 1765
1748=item ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop) 1766=item ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines