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

Comparing libev/ev.pod (file contents):
Revision 1.76 by root, Sat Dec 8 15:30:30 2007 UTC vs.
Revision 1.89 by root, Wed Dec 19 01:59:29 2007 UTC

98Libev represents time as a single floating point number, representing the 98Libev represents time as a single floating point number, representing the
99(fractional) number of seconds since the (POSIX) epoch (somewhere near 99(fractional) number of seconds since the (POSIX) epoch (somewhere near
100the beginning of 1970, details are complicated, don't ask). This type is 100the beginning of 1970, details are complicated, don't ask). This type is
101called C<ev_tstamp>, which is what you should use too. It usually aliases 101called C<ev_tstamp>, which is what you should use too. It usually aliases
102to the C<double> type in C, and when you need to do any calculations on 102to the C<double> type in C, and when you need to do any calculations on
103it, you should treat it as such. 103it, you should treat it as some floatingpoint value. Unlike the name
104component C<stamp> might indicate, it is also used for time differences
105throughout libev.
104 106
105=head1 GLOBAL FUNCTIONS 107=head1 GLOBAL FUNCTIONS
106 108
107These functions can be called anytime, even before initialising the 109These functions can be called anytime, even before initialising the
108library in any way. 110library in any way.
117 119
118=item int ev_version_major () 120=item int ev_version_major ()
119 121
120=item int ev_version_minor () 122=item int ev_version_minor ()
121 123
122You can find out the major and minor version numbers of the library 124You can find out the major and minor ABI version numbers of the library
123you linked against by calling the functions C<ev_version_major> and 125you linked against by calling the functions C<ev_version_major> and
124C<ev_version_minor>. If you want, you can compare against the global 126C<ev_version_minor>. If you want, you can compare against the global
125symbols C<EV_VERSION_MAJOR> and C<EV_VERSION_MINOR>, which specify the 127symbols C<EV_VERSION_MAJOR> and C<EV_VERSION_MINOR>, which specify the
126version of the library your program was compiled against. 128version of the library your program was compiled against.
127 129
130These version numbers refer to the ABI version of the library, not the
131release version.
132
128Usually, it's a good idea to terminate if the major versions mismatch, 133Usually, it's a good idea to terminate if the major versions mismatch,
129as this indicates an incompatible change. Minor versions are usually 134as this indicates an incompatible change. Minor versions are usually
130compatible to older versions, so a larger minor version alone is usually 135compatible to older versions, so a larger minor version alone is usually
131not a problem. 136not a problem.
132 137
133Example: Make sure we haven't accidentally been linked against the wrong 138Example: Make sure we haven't accidentally been linked against the wrong
134version. 139version.
399Destroys the default loop again (frees all memory and kernel state 404Destroys the default loop again (frees all memory and kernel state
400etc.). None of the active event watchers will be stopped in the normal 405etc.). None of the active event watchers will be stopped in the normal
401sense, so e.g. C<ev_is_active> might still return true. It is your 406sense, so e.g. C<ev_is_active> might still return true. It is your
402responsibility to either stop all watchers cleanly yoursef I<before> 407responsibility to either stop all watchers cleanly yoursef I<before>
403calling this function, or cope with the fact afterwards (which is usually 408calling this function, or cope with the fact afterwards (which is usually
404the easiest thing, youc na just ignore the watchers and/or C<free ()> them 409the easiest thing, you can just ignore the watchers and/or C<free ()> them
405for example). 410for example).
411
412Note that certain global state, such as signal state, will not be freed by
413this function, and related watchers (such as signal and child watchers)
414would need to be stopped manually.
415
416In general it is not advisable to call this function except in the
417rare occasion where you really need to free e.g. the signal handling
418pipe fds. If you need dynamically allocated loops it is better to use
419C<ev_loop_new> and C<ev_loop_destroy>).
406 420
407=item ev_loop_destroy (loop) 421=item ev_loop_destroy (loop)
408 422
409Like C<ev_default_destroy>, but destroys an event loop created by an 423Like C<ev_default_destroy>, but destroys an event loop created by an
410earlier call to C<ev_loop_new>. 424earlier call to C<ev_loop_new>.
486libev watchers. However, a pair of C<ev_prepare>/C<ev_check> watchers is 500libev watchers. However, a pair of C<ev_prepare>/C<ev_check> watchers is
487usually a better approach for this kind of thing. 501usually a better approach for this kind of thing.
488 502
489Here are the gory details of what C<ev_loop> does: 503Here are the gory details of what C<ev_loop> does:
490 504
505 - Before the first iteration, call any pending watchers.
491 * If there are no active watchers (reference count is zero), return. 506 * If there are no active watchers (reference count is zero), return.
492 - Queue prepare watchers and then call all outstanding watchers. 507 - Queue all prepare watchers and then call all outstanding watchers.
493 - If we have been forked, recreate the kernel state. 508 - If we have been forked, recreate the kernel state.
494 - Update the kernel state with all outstanding changes. 509 - Update the kernel state with all outstanding changes.
495 - Update the "event loop time". 510 - Update the "event loop time".
496 - Calculate for how long to block. 511 - Calculate for how long to block.
497 - Block the process, waiting for any events. 512 - Block the process, waiting for any events.
907play around with an Xlib connection), then you have to seperately re-test 922play around with an Xlib connection), then you have to seperately re-test
908whether a file descriptor is really ready with a known-to-be good interface 923whether a file descriptor is really ready with a known-to-be good interface
909such as poll (fortunately in our Xlib example, Xlib already does this on 924such as poll (fortunately in our Xlib example, Xlib already does this on
910its own, so its quite safe to use). 925its own, so its quite safe to use).
911 926
927=head3 The special problem of disappearing file descriptors
928
929Some backends (e.g kqueue, epoll) need to be told about closing a file
930descriptor (either by calling C<close> explicitly or by any other means,
931such as C<dup>). The reason is that you register interest in some file
932descriptor, but when it goes away, the operating system will silently drop
933this interest. If another file descriptor with the same number then is
934registered with libev, there is no efficient way to see that this is, in
935fact, a different file descriptor.
936
937To avoid having to explicitly tell libev about such cases, libev follows
938the following policy: Each time C<ev_io_set> is being called, libev
939will assume that this is potentially a new file descriptor, otherwise
940it is assumed that the file descriptor stays the same. That means that
941you I<have> to call C<ev_io_set> (or C<ev_io_init>) when you change the
942descriptor even if the file descriptor number itself did not change.
943
944This is how one would do it normally anyway, the important point is that
945the libev application should not optimise around libev but should leave
946optimisations to libev.
947
948
949=head3 Watcher-Specific Functions
950
912=over 4 951=over 4
913 952
914=item ev_io_init (ev_io *, callback, int fd, int events) 953=item ev_io_init (ev_io *, callback, int fd, int events)
915 954
916=item ev_io_set (ev_io *, int fd, int events) 955=item ev_io_set (ev_io *, int fd, int events)
968 ev_timer_set (&timer, after + ev_now () - ev_time (), 0.); 1007 ev_timer_set (&timer, after + ev_now () - ev_time (), 0.);
969 1008
970The callback is guarenteed to be invoked only when its timeout has passed, 1009The callback is guarenteed to be invoked only when its timeout has passed,
971but if multiple timers become ready during the same loop iteration then 1010but if multiple timers become ready during the same loop iteration then
972order of execution is undefined. 1011order of execution is undefined.
1012
1013=head3 Watcher-Specific Functions and Data Members
973 1014
974=over 4 1015=over 4
975 1016
976=item ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat) 1017=item ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)
977 1018
1073but on wallclock time (absolute time). You can tell a periodic watcher 1114but on wallclock time (absolute time). You can tell a periodic watcher
1074to trigger "at" some specific point in time. For example, if you tell a 1115to trigger "at" some specific point in time. For example, if you tell a
1075periodic watcher to trigger in 10 seconds (by specifiying e.g. C<ev_now () 1116periodic watcher to trigger in 10 seconds (by specifiying e.g. C<ev_now ()
1076+ 10.>) and then reset your system clock to the last year, then it will 1117+ 10.>) and then reset your system clock to the last year, then it will
1077take a year to trigger the event (unlike an C<ev_timer>, which would trigger 1118take a year to trigger the event (unlike an C<ev_timer>, which would trigger
1078roughly 10 seconds later and of course not if you reset your system time 1119roughly 10 seconds later).
1079again).
1080 1120
1081They can also be used to implement vastly more complex timers, such as 1121They can also be used to implement vastly more complex timers, such as
1082triggering an event on eahc midnight, local time. 1122triggering an event on each midnight, local time or other, complicated,
1123rules.
1083 1124
1084As with timers, the callback is guarenteed to be invoked only when the 1125As with timers, the callback is guarenteed to be invoked only when the
1085time (C<at>) has been passed, but if multiple periodic timers become ready 1126time (C<at>) has been passed, but if multiple periodic timers become ready
1086during the same loop iteration then order of execution is undefined. 1127during the same loop iteration then order of execution is undefined.
1087 1128
1129=head3 Watcher-Specific Functions and Data Members
1130
1088=over 4 1131=over 4
1089 1132
1090=item ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb) 1133=item ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb)
1091 1134
1092=item ev_periodic_set (ev_periodic *, ev_tstamp after, ev_tstamp repeat, reschedule_cb) 1135=item ev_periodic_set (ev_periodic *, ev_tstamp after, ev_tstamp repeat, reschedule_cb)
1094Lots of arguments, lets sort it out... There are basically three modes of 1137Lots of arguments, lets sort it out... There are basically three modes of
1095operation, and we will explain them from simplest to complex: 1138operation, and we will explain them from simplest to complex:
1096 1139
1097=over 4 1140=over 4
1098 1141
1099=item * absolute timer (interval = reschedule_cb = 0) 1142=item * absolute timer (at = time, interval = reschedule_cb = 0)
1100 1143
1101In this configuration the watcher triggers an event at the wallclock time 1144In this configuration the watcher triggers an event at the wallclock time
1102C<at> and doesn't repeat. It will not adjust when a time jump occurs, 1145C<at> and doesn't repeat. It will not adjust when a time jump occurs,
1103that is, if it is to be run at January 1st 2011 then it will run when the 1146that is, if it is to be run at January 1st 2011 then it will run when the
1104system time reaches or surpasses this time. 1147system time reaches or surpasses this time.
1105 1148
1106=item * non-repeating interval timer (interval > 0, reschedule_cb = 0) 1149=item * non-repeating interval timer (at = offset, interval > 0, reschedule_cb = 0)
1107 1150
1108In this mode the watcher will always be scheduled to time out at the next 1151In this mode the watcher will always be scheduled to time out at the next
1109C<at + N * interval> time (for some integer N) and then repeat, regardless 1152C<at + N * interval> time (for some integer N, which can also be negative)
1110of any time jumps. 1153and then repeat, regardless of any time jumps.
1111 1154
1112This can be used to create timers that do not drift with respect to system 1155This can be used to create timers that do not drift with respect to system
1113time: 1156time:
1114 1157
1115 ev_periodic_set (&periodic, 0., 3600., 0); 1158 ev_periodic_set (&periodic, 0., 3600., 0);
1121 1164
1122Another way to think about it (for the mathematically inclined) is that 1165Another way to think about it (for the mathematically inclined) is that
1123C<ev_periodic> will try to run the callback in this mode at the next possible 1166C<ev_periodic> will try to run the callback in this mode at the next possible
1124time where C<time = at (mod interval)>, regardless of any time jumps. 1167time where C<time = at (mod interval)>, regardless of any time jumps.
1125 1168
1169For numerical stability it is preferable that the C<at> value is near
1170C<ev_now ()> (the current time), but there is no range requirement for
1171this value.
1172
1126=item * manual reschedule mode (reschedule_cb = callback) 1173=item * manual reschedule mode (at and interval ignored, reschedule_cb = callback)
1127 1174
1128In this mode the values for C<interval> and C<at> are both being 1175In this mode the values for C<interval> and C<at> are both being
1129ignored. Instead, each time the periodic watcher gets scheduled, the 1176ignored. Instead, each time the periodic watcher gets scheduled, the
1130reschedule callback will be called with the watcher as first, and the 1177reschedule callback will be called with the watcher as first, and the
1131current time as second argument. 1178current time as second argument.
1132 1179
1133NOTE: I<This callback MUST NOT stop or destroy any periodic watcher, 1180NOTE: I<This callback MUST NOT stop or destroy any periodic watcher,
1134ever, or make any event loop modifications>. If you need to stop it, 1181ever, or make any event loop modifications>. If you need to stop it,
1135return C<now + 1e30> (or so, fudge fudge) and stop it afterwards (e.g. by 1182return C<now + 1e30> (or so, fudge fudge) and stop it afterwards (e.g. by
1136starting a prepare watcher). 1183starting an C<ev_prepare> watcher, which is legal).
1137 1184
1138Its prototype is C<ev_tstamp (*reschedule_cb)(struct ev_periodic *w, 1185Its prototype is C<ev_tstamp (*reschedule_cb)(struct ev_periodic *w,
1139ev_tstamp now)>, e.g.: 1186ev_tstamp now)>, e.g.:
1140 1187
1141 static ev_tstamp my_rescheduler (struct ev_periodic *w, ev_tstamp now) 1188 static ev_tstamp my_rescheduler (struct ev_periodic *w, ev_tstamp now)
1164Simply stops and restarts the periodic watcher again. This is only useful 1211Simply stops and restarts the periodic watcher again. This is only useful
1165when you changed some parameters or the reschedule callback would return 1212when you changed some parameters or the reschedule callback would return
1166a different time than the last time it was called (e.g. in a crond like 1213a different time than the last time it was called (e.g. in a crond like
1167program when the crontabs have changed). 1214program when the crontabs have changed).
1168 1215
1216=item ev_tstamp offset [read-write]
1217
1218When repeating, this contains the offset value, otherwise this is the
1219absolute point in time (the C<at> value passed to C<ev_periodic_set>).
1220
1221Can be modified any time, but changes only take effect when the periodic
1222timer fires or C<ev_periodic_again> is being called.
1223
1169=item ev_tstamp interval [read-write] 1224=item ev_tstamp interval [read-write]
1170 1225
1171The current interval value. Can be modified any time, but changes only 1226The current interval value. Can be modified any time, but changes only
1172take effect when the periodic timer fires or C<ev_periodic_again> is being 1227take effect when the periodic timer fires or C<ev_periodic_again> is being
1173called. 1228called.
1175=item ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) [read-write] 1230=item ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) [read-write]
1176 1231
1177The current reschedule callback, or C<0>, if this functionality is 1232The current reschedule callback, or C<0>, if this functionality is
1178switched off. Can be changed any time, but changes only take effect when 1233switched off. Can be changed any time, but changes only take effect when
1179the periodic timer fires or C<ev_periodic_again> is being called. 1234the periodic timer fires or C<ev_periodic_again> is being called.
1235
1236=item ev_tstamp at [read-only]
1237
1238When active, contains the absolute time that the watcher is supposed to
1239trigger next.
1180 1240
1181=back 1241=back
1182 1242
1183Example: Call a callback every hour, or, more precisely, whenever the 1243Example: Call a callback every hour, or, more precisely, whenever the
1184system clock is divisible by 3600. The callback invocation times have 1244system clock is divisible by 3600. The callback invocation times have
1226with the kernel (thus it coexists with your own signal handlers as long 1286with the kernel (thus it coexists with your own signal handlers as long
1227as you don't register any with libev). Similarly, when the last signal 1287as you don't register any with libev). Similarly, when the last signal
1228watcher for a signal is stopped libev will reset the signal handler to 1288watcher for a signal is stopped libev will reset the signal handler to
1229SIG_DFL (regardless of what it was set to before). 1289SIG_DFL (regardless of what it was set to before).
1230 1290
1291=head3 Watcher-Specific Functions and Data Members
1292
1231=over 4 1293=over 4
1232 1294
1233=item ev_signal_init (ev_signal *, callback, int signum) 1295=item ev_signal_init (ev_signal *, callback, int signum)
1234 1296
1235=item ev_signal_set (ev_signal *, int signum) 1297=item ev_signal_set (ev_signal *, int signum)
1246 1308
1247=head2 C<ev_child> - watch out for process status changes 1309=head2 C<ev_child> - watch out for process status changes
1248 1310
1249Child watchers trigger when your process receives a SIGCHLD in response to 1311Child watchers trigger when your process receives a SIGCHLD in response to
1250some child status changes (most typically when a child of yours dies). 1312some child status changes (most typically when a child of yours dies).
1313
1314=head3 Watcher-Specific Functions and Data Members
1251 1315
1252=over 4 1316=over 4
1253 1317
1254=item ev_child_init (ev_child *, callback, int pid) 1318=item ev_child_init (ev_child *, callback, int pid)
1255 1319
1323reader). Inotify will be used to give hints only and should not change the 1387reader). Inotify will be used to give hints only and should not change the
1324semantics of C<ev_stat> watchers, which means that libev sometimes needs 1388semantics of C<ev_stat> watchers, which means that libev sometimes needs
1325to fall back to regular polling again even with inotify, but changes are 1389to fall back to regular polling again even with inotify, but changes are
1326usually detected immediately, and if the file exists there will be no 1390usually detected immediately, and if the file exists there will be no
1327polling. 1391polling.
1392
1393=head3 Watcher-Specific Functions and Data Members
1328 1394
1329=over 4 1395=over 4
1330 1396
1331=item ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval) 1397=item ev_stat_init (ev_stat *, callback, const char *path, ev_tstamp interval)
1332 1398
1415Apart from keeping your process non-blocking (which is a useful 1481Apart from keeping your process non-blocking (which is a useful
1416effect on its own sometimes), idle watchers are a good place to do 1482effect on its own sometimes), idle watchers are a good place to do
1417"pseudo-background processing", or delay processing stuff to after the 1483"pseudo-background processing", or delay processing stuff to after the
1418event loop has handled all outstanding events. 1484event loop has handled all outstanding events.
1419 1485
1486=head3 Watcher-Specific Functions and Data Members
1487
1420=over 4 1488=over 4
1421 1489
1422=item ev_idle_init (ev_signal *, callback) 1490=item ev_idle_init (ev_signal *, callback)
1423 1491
1424Initialises and configures the idle watcher - it has no parameters of any 1492Initialises and configures the idle watcher - it has no parameters of any
1480are ready to run (it's actually more complicated: it only runs coroutines 1548are ready to run (it's actually more complicated: it only runs coroutines
1481with priority higher than or equal to the event loop and one coroutine 1549with priority higher than or equal to the event loop and one coroutine
1482of lower priority, but only once, using idle watchers to keep the event 1550of lower priority, but only once, using idle watchers to keep the event
1483loop from blocking if lower-priority coroutines are active, thus mapping 1551loop from blocking if lower-priority coroutines are active, thus mapping
1484low-priority coroutines to idle/background tasks). 1552low-priority coroutines to idle/background tasks).
1553
1554It is recommended to give C<ev_check> watchers highest (C<EV_MAXPRI>)
1555priority, to ensure that they are being run before any other watchers
1556after the poll. Also, C<ev_check> watchers (and C<ev_prepare> watchers,
1557too) should not activate ("feed") events into libev. While libev fully
1558supports this, they will be called before other C<ev_check> watchers did
1559their job. As C<ev_check> watchers are often used to embed other event
1560loops those other event loops might be in an unusable state until their
1561C<ev_check> watcher ran (always remind yourself to coexist peacefully with
1562others).
1563
1564=head3 Watcher-Specific Functions and Data Members
1485 1565
1486=over 4 1566=over 4
1487 1567
1488=item ev_prepare_init (ev_prepare *, callback) 1568=item ev_prepare_init (ev_prepare *, callback)
1489 1569
1691 ev_embed_start (loop_hi, &embed); 1771 ev_embed_start (loop_hi, &embed);
1692 } 1772 }
1693 else 1773 else
1694 loop_lo = loop_hi; 1774 loop_lo = loop_hi;
1695 1775
1776=head3 Watcher-Specific Functions and Data Members
1777
1696=over 4 1778=over 4
1697 1779
1698=item ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop) 1780=item ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)
1699 1781
1700=item ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop) 1782=item ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop)
1726event loop blocks next and before C<ev_check> watchers are being called, 1808event loop blocks next and before C<ev_check> watchers are being called,
1727and only in the child after the fork. If whoever good citizen calling 1809and only in the child after the fork. If whoever good citizen calling
1728C<ev_default_fork> cheats and calls it in the wrong process, the fork 1810C<ev_default_fork> cheats and calls it in the wrong process, the fork
1729handlers will be invoked, too, of course. 1811handlers will be invoked, too, of course.
1730 1812
1813=head3 Watcher-Specific Functions and Data Members
1814
1731=over 4 1815=over 4
1732 1816
1733=item ev_fork_init (ev_signal *, callback) 1817=item ev_fork_init (ev_signal *, callback)
1734 1818
1735Initialises and configures the fork watcher - it has no parameters of any 1819Initialises and configures the fork watcher - it has no parameters of any
1951 2035
1952=item w->stop () 2036=item w->stop ()
1953 2037
1954Stops the watcher if it is active. Again, no C<loop> argument. 2038Stops the watcher if it is active. Again, no C<loop> argument.
1955 2039
1956=item w->again () C<ev::timer>, C<ev::periodic> only 2040=item w->again () (C<ev::timer>, C<ev::periodic> only)
1957 2041
1958For C<ev::timer> and C<ev::periodic>, this invokes the corresponding 2042For C<ev::timer> and C<ev::periodic>, this invokes the corresponding
1959C<ev_TYPE_again> function. 2043C<ev_TYPE_again> function.
1960 2044
1961=item w->sweep () C<ev::embed> only 2045=item w->sweep () (C<ev::embed> only)
1962 2046
1963Invokes C<ev_embed_sweep>. 2047Invokes C<ev_embed_sweep>.
1964 2048
1965=item w->update () C<ev::stat> only 2049=item w->update () (C<ev::stat> only)
1966 2050
1967Invokes C<ev_stat_stat>. 2051Invokes C<ev_stat_stat>.
1968 2052
1969=back 2053=back
1970 2054
1990 } 2074 }
1991 2075
1992 2076
1993=head1 MACRO MAGIC 2077=head1 MACRO MAGIC
1994 2078
1995Libev can be compiled with a variety of options, the most fundemantal is 2079Libev can be compiled with a variety of options, the most fundamantal
1996C<EV_MULTIPLICITY>. This option determines whether (most) functions and 2080of which is C<EV_MULTIPLICITY>. This option determines whether (most)
1997callbacks have an initial C<struct ev_loop *> argument. 2081functions and callbacks have an initial C<struct ev_loop *> argument.
1998 2082
1999To make it easier to write programs that cope with either variant, the 2083To make it easier to write programs that cope with either variant, the
2000following macros are defined: 2084following macros are defined:
2001 2085
2002=over 4 2086=over 4
2361definition and a statement, respectively. See the F<ev.v> header file for 2445definition and a statement, respectively. See the F<ev.v> header file for
2362their default definitions. One possible use for overriding these is to 2446their default definitions. One possible use for overriding these is to
2363avoid the C<struct ev_loop *> as first argument in all cases, or to use 2447avoid the C<struct ev_loop *> as first argument in all cases, or to use
2364method calls instead of plain function calls in C++. 2448method calls instead of plain function calls in C++.
2365 2449
2450=head2 EXPORTED API SYMBOLS
2451
2452If you need to re-export the API (e.g. via a dll) and you need a list of
2453exported symbols, you can use the provided F<Symbol.*> files which list
2454all public symbols, one per line:
2455
2456 Symbols.ev for libev proper
2457 Symbols.event for the libevent emulation
2458
2459This can also be used to rename all public symbols to avoid clashes with
2460multiple versions of libev linked together (which is obviously bad in
2461itself, but sometimes it is inconvinient to avoid this).
2462
2463A sed comamnd like this will create wrapper C<#define>'s that you need to
2464include before including F<ev.h>:
2465
2466 <Symbols.ev sed -e "s/.*/#define & myprefix_&/" >wrap.h
2467
2468This would create a file F<wrap.h> which essentially looks like this:
2469
2470 #define ev_backend myprefix_ev_backend
2471 #define ev_check_start myprefix_ev_check_start
2472 #define ev_check_stop myprefix_ev_check_stop
2473 ...
2474
2366=head2 EXAMPLES 2475=head2 EXAMPLES
2367 2476
2368For a real-world example of a program the includes libev 2477For a real-world example of a program the includes libev
2369verbatim, you can have a look at the EV perl module 2478verbatim, you can have a look at the EV perl module
2370(L<http://software.schmorp.de/pkg/EV.html>). It has the libev files in 2479(L<http://software.schmorp.de/pkg/EV.html>). It has the libev files in

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines