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

Comparing libev/ev.3 (file contents):
Revision 1.51 by root, Wed Dec 12 17:55:30 2007 UTC vs.
Revision 1.52 by root, Wed Dec 19 00:56:39 2007 UTC

126. ds Ae AE 126. ds Ae AE
127.\} 127.\}
128.rm #[ #] #H #V #F C 128.rm #[ #] #H #V #F C
129.\" ======================================================================== 129.\" ========================================================================
130.\" 130.\"
131.IX Title ""<STANDARD INPUT>" 1" 131.IX Title "EV 1"
132.TH "<STANDARD INPUT>" 1 "2007-12-12" "perl v5.8.8" "User Contributed Perl Documentation" 132.TH EV 1 "2007-12-18" "perl v5.8.8" "User Contributed Perl Documentation"
133.SH "NAME" 133.SH "NAME"
134libev \- a high performance full\-featured event loop written in C 134libev \- a high performance full\-featured event loop written in C
135.SH "SYNOPSIS" 135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS" 136.IX Header "SYNOPSIS"
137.Vb 1 137.Vb 1
243Libev represents time as a single floating point number, representing the 243Libev represents time as a single floating point number, representing the
244(fractional) number of seconds since the (\s-1POSIX\s0) epoch (somewhere near 244(fractional) number of seconds since the (\s-1POSIX\s0) epoch (somewhere near
245the beginning of 1970, details are complicated, don't ask). This type is 245the beginning of 1970, details are complicated, don't ask). This type is
246called \f(CW\*(C`ev_tstamp\*(C'\fR, which is what you should use too. It usually aliases 246called \f(CW\*(C`ev_tstamp\*(C'\fR, which is what you should use too. It usually aliases
247to the \f(CW\*(C`double\*(C'\fR type in C, and when you need to do any calculations on 247to the \f(CW\*(C`double\*(C'\fR type in C, and when you need to do any calculations on
248it, you should treat it as such. 248it, you should treat it as some floatingpoint value. Unlike the name
249component \f(CW\*(C`stamp\*(C'\fR might indicate, it is also used for time differences
250throughout libev.
249.SH "GLOBAL FUNCTIONS" 251.SH "GLOBAL FUNCTIONS"
250.IX Header "GLOBAL FUNCTIONS" 252.IX Header "GLOBAL FUNCTIONS"
251These functions can be called anytime, even before initialising the 253These functions can be called anytime, even before initialising the
252library in any way. 254library in any way.
253.IP "ev_tstamp ev_time ()" 4 255.IP "ev_tstamp ev_time ()" 4
555Destroys the default loop again (frees all memory and kernel state 557Destroys the default loop again (frees all memory and kernel state
556etc.). None of the active event watchers will be stopped in the normal 558etc.). None of the active event watchers will be stopped in the normal
557sense, so e.g. \f(CW\*(C`ev_is_active\*(C'\fR might still return true. It is your 559sense, so e.g. \f(CW\*(C`ev_is_active\*(C'\fR might still return true. It is your
558responsibility to either stop all watchers cleanly yoursef \fIbefore\fR 560responsibility to either stop all watchers cleanly yoursef \fIbefore\fR
559calling this function, or cope with the fact afterwards (which is usually 561calling this function, or cope with the fact afterwards (which is usually
560the easiest thing, youc na just ignore the watchers and/or \f(CW\*(C`free ()\*(C'\fR them 562the easiest thing, you can just ignore the watchers and/or \f(CW\*(C`free ()\*(C'\fR them
561for example). 563for example).
564.Sp
565Not that certain global state, such as signal state, will not be freed by
566this function, and related watchers (such as signal and child watchers)
567would need to be stopped manually.
568.Sp
569In general it is not advisable to call this function except in the
570rare occasion where you really need to free e.g. the signal handling
571pipe fds. If you need dynamically allocated loops it is better to use
572\&\f(CW\*(C`ev_loop_new\*(C'\fR and \f(CW\*(C`ev_loop_destroy\*(C'\fR).
562.IP "ev_loop_destroy (loop)" 4 573.IP "ev_loop_destroy (loop)" 4
563.IX Item "ev_loop_destroy (loop)" 574.IX Item "ev_loop_destroy (loop)"
564Like \f(CW\*(C`ev_default_destroy\*(C'\fR, but destroys an event loop created by an 575Like \f(CW\*(C`ev_default_destroy\*(C'\fR, but destroys an event loop created by an
565earlier call to \f(CW\*(C`ev_loop_new\*(C'\fR. 576earlier call to \f(CW\*(C`ev_loop_new\*(C'\fR.
566.IP "ev_default_fork ()" 4 577.IP "ev_default_fork ()" 4
1379.IP "ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) [read\-write]" 4 1390.IP "ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) [read\-write]" 4
1380.IX Item "ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) [read-write]" 1391.IX Item "ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) [read-write]"
1381The current reschedule callback, or \f(CW0\fR, if this functionality is 1392The current reschedule callback, or \f(CW0\fR, if this functionality is
1382switched off. Can be changed any time, but changes only take effect when 1393switched off. Can be changed any time, but changes only take effect when
1383the periodic timer fires or \f(CW\*(C`ev_periodic_again\*(C'\fR is being called. 1394the periodic timer fires or \f(CW\*(C`ev_periodic_again\*(C'\fR is being called.
1395.IP "ev_tstamp at [read\-only]" 4
1396.IX Item "ev_tstamp at [read-only]"
1397When active, contains the absolute time that the watcher is supposed to
1398trigger next.
1384.PP 1399.PP
1385Example: Call a callback every hour, or, more precisely, whenever the 1400Example: Call a callback every hour, or, more precisely, whenever the
1386system clock is divisible by 3600. The callback invocation times have 1401system clock is divisible by 3600. The callback invocation times have
1387potentially a lot of jittering, but good long-term stability. 1402potentially a lot of jittering, but good long-term stability.
1388.PP 1403.PP
2199Starts the watcher. Note that there is no \f(CW\*(C`loop\*(C'\fR argument, as the 2214Starts the watcher. Note that there is no \f(CW\*(C`loop\*(C'\fR argument, as the
2200constructor already stores the event loop. 2215constructor already stores the event loop.
2201.IP "w\->stop ()" 4 2216.IP "w\->stop ()" 4
2202.IX Item "w->stop ()" 2217.IX Item "w->stop ()"
2203Stops the watcher if it is active. Again, no \f(CW\*(C`loop\*(C'\fR argument. 2218Stops the watcher if it is active. Again, no \f(CW\*(C`loop\*(C'\fR argument.
2204.ie n .IP "w\->again () ""ev::timer""\fR, \f(CW""ev::periodic"" only" 4 2219.ie n .IP "w\->again () (""ev::timer""\fR, \f(CW""ev::periodic"" only)" 4
2205.el .IP "w\->again () \f(CWev::timer\fR, \f(CWev::periodic\fR only" 4 2220.el .IP "w\->again () (\f(CWev::timer\fR, \f(CWev::periodic\fR only)" 4
2206.IX Item "w->again () ev::timer, ev::periodic only" 2221.IX Item "w->again () (ev::timer, ev::periodic only)"
2207For \f(CW\*(C`ev::timer\*(C'\fR and \f(CW\*(C`ev::periodic\*(C'\fR, this invokes the corresponding 2222For \f(CW\*(C`ev::timer\*(C'\fR and \f(CW\*(C`ev::periodic\*(C'\fR, this invokes the corresponding
2208\&\f(CW\*(C`ev_TYPE_again\*(C'\fR function. 2223\&\f(CW\*(C`ev_TYPE_again\*(C'\fR function.
2209.ie n .IP "w\->sweep () ""ev::embed"" only" 4 2224.ie n .IP "w\->sweep () (""ev::embed"" only)" 4
2210.el .IP "w\->sweep () \f(CWev::embed\fR only" 4 2225.el .IP "w\->sweep () (\f(CWev::embed\fR only)" 4
2211.IX Item "w->sweep () ev::embed only" 2226.IX Item "w->sweep () (ev::embed only)"
2212Invokes \f(CW\*(C`ev_embed_sweep\*(C'\fR. 2227Invokes \f(CW\*(C`ev_embed_sweep\*(C'\fR.
2213.ie n .IP "w\->update () ""ev::stat"" only" 4 2228.ie n .IP "w\->update () (""ev::stat"" only)" 4
2214.el .IP "w\->update () \f(CWev::stat\fR only" 4 2229.el .IP "w\->update () (\f(CWev::stat\fR only)" 4
2215.IX Item "w->update () ev::stat only" 2230.IX Item "w->update () (ev::stat only)"
2216Invokes \f(CW\*(C`ev_stat_stat\*(C'\fR. 2231Invokes \f(CW\*(C`ev_stat_stat\*(C'\fR.
2217.RE 2232.RE
2218.RS 4 2233.RS 4
2219.RE 2234.RE
2220.PP 2235.PP
2244\& io.start (fd, ev::READ); 2259\& io.start (fd, ev::READ);
2245\& } 2260\& }
2246.Ve 2261.Ve
2247.SH "MACRO MAGIC" 2262.SH "MACRO MAGIC"
2248.IX Header "MACRO MAGIC" 2263.IX Header "MACRO MAGIC"
2249Libev can be compiled with a variety of options, the most fundemantal is 2264Libev can be compiled with a variety of options, the most fundamantal
2250\&\f(CW\*(C`EV_MULTIPLICITY\*(C'\fR. This option determines whether (most) functions and 2265of which is \f(CW\*(C`EV_MULTIPLICITY\*(C'\fR. This option determines whether (most)
2251callbacks have an initial \f(CW\*(C`struct ev_loop *\*(C'\fR argument. 2266functions and callbacks have an initial \f(CW\*(C`struct ev_loop *\*(C'\fR argument.
2252.PP 2267.PP
2253To make it easier to write programs that cope with either variant, the 2268To make it easier to write programs that cope with either variant, the
2254following macros are defined: 2269following macros are defined:
2255.ie n .IP """EV_A""\fR, \f(CW""EV_A_""" 4 2270.ie n .IP """EV_A""\fR, \f(CW""EV_A_""" 4
2256.el .IP "\f(CWEV_A\fR, \f(CWEV_A_\fR" 4 2271.el .IP "\f(CWEV_A\fR, \f(CWEV_A_\fR" 4

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines