diff options
-rw-r--r-- | ev.html | 15 | ||||
-rw-r--r-- | ev.pod | 16 |
2 files changed, 20 insertions, 11 deletions
@@ -6,7 +6,7 @@ <meta name="description" content="Pod documentation for libev" /> <meta name="inputfile" content="<standard input>" /> <meta name="outputfile" content="<standard output>" /> - <meta name="created" content="Mon Nov 12 09:47:14 2007" /> + <meta name="created" content="Mon Nov 12 09:57:02 2007" /> <meta name="generator" content="Pod::Xhtml 1.57" /> <link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head> <body> @@ -19,7 +19,8 @@ <li><a href="#DESCRIPTION">DESCRIPTION</a></li> <li><a href="#FEATURES">FEATURES</a></li> <li><a href="#CONVENTIONS">CONVENTIONS</a></li> -<li><a href="#TIME_AND_OTHER_GLOBAL_FUNCTIONS">TIME AND OTHER GLOBAL FUNCTIONS</a></li> +<li><a href="#TIME_REPRESENTATION">TIME REPRESENTATION</a></li> +<li><a href="#GLOBAL_FUNCTIONS">GLOBAL FUNCTIONS</a></li> <li><a href="#FUNCTIONS_CONTROLLING_THE_EVENT_LOOP">FUNCTIONS CONTROLLING THE EVENT LOOP</a></li> <li><a href="#ANATOMY_OF_A_WATCHER">ANATOMY OF A WATCHER</a> <ul><li><a href="#ASSOCIATING_CUSTOM_DATA_WITH_A_WATCH">ASSOCIATING CUSTOM DATA WITH A WATCHER</a></li> @@ -89,13 +90,17 @@ argument of name <code>loop</code> (which is always of type <code>struct ev_loop will not have this argument.</p> </div> -<h1 id="TIME_AND_OTHER_GLOBAL_FUNCTIONS">TIME AND OTHER GLOBAL FUNCTIONS</h1><p><a href="#TOP" class="toplink">Top</a></p> -<div id="TIME_AND_OTHER_GLOBAL_FUNCTIONS_CONT"> +<h1 id="TIME_REPRESENTATION">TIME REPRESENTATION</h1><p><a href="#TOP" class="toplink">Top</a></p> +<div id="TIME_REPRESENTATION_CONTENT"> <p>Libev represents time as a single floating point number, representing the (fractional) number of seconds since the (POSIX) epoch (somewhere near the beginning of 1970, details are complicated, don't ask). This type is called <code>ev_tstamp</code>, which is what you should use too. It usually aliases to the double type in C.</p> + +</div> +<h1 id="GLOBAL_FUNCTIONS">GLOBAL FUNCTIONS</h1><p><a href="#TOP" class="toplink">Top</a></p> +<div id="GLOBAL_FUNCTIONS_CONTENT"> <dl> <dt>ev_tstamp ev_time ()</dt> <dd> @@ -144,7 +149,7 @@ requested operation, or, if the condition doesn't go away, do bad stuff types of such loops, the <i>default</i> loop, which supports signals and child events, and dynamically created loops which do not.</p> <p>If you use threads, a common model is to run the default event loop -in your main thread (or in a separate thrad) and for each thread you +in your main thread (or in a separate thread) and for each thread you create, you also create another event loop. Libev itself does no locking whatsoever, so if you mix calls to the same event loop in different threads, make sure you lock (this is usually a bad idea, though, even if @@ -51,6 +51,9 @@ to the double type in C. =head1 GLOBAL FUNCTIONS +These functions can be called anytime, even before initialising the +library in any way. + =over 4 =item ev_tstamp ev_time () @@ -562,12 +565,10 @@ ignored. Instead, each time the periodic watcher gets scheduled, the reschedule callback will be called with the watcher as first, and the current time as second argument. -NOTE: I<This callback MUST NOT stop or destroy the periodic or any other -periodic watcher, ever, or make any event loop modifications>. If you need -to stop it, return C<now + 1e30> (or so, fudge fudge) and stop it afterwards. - -Also, I<< this callback must always return a time that is later than the -passed C<now> value >>. Not even C<now> itself will be ok. +NOTE: I<This callback MUST NOT stop or destroy any periodic watcher, +ever, or make any event loop modifications>. If you need to stop it, +return C<now + 1e30> (or so, fudge fudge) and stop it afterwards (e.g. by +starting a prepare watcher). Its prototype is C<ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now)>, e.g.: @@ -582,6 +583,9 @@ It must return the next time to trigger, based on the passed time value will usually be called just before the callback will be triggered, but might be called at other times, too. +NOTE: I<< This callback must always return a time that is later than the +passed C<now> value >>. Not even C<now> itself will do, it must be larger. + This can be used to create very complex timers, such as a timer that triggers on each midnight, local time. To do this, you would calculate the next midnight after C<now> and return the timestamp value for this. How you do this |