… | |
… | |
39 | F<README.embed> in the libev distribution. If libev was configured without |
39 | F<README.embed> in the libev distribution. If libev was configured without |
40 | support for multiple event loops, then all functions taking an initial |
40 | support for multiple event loops, then all functions taking an initial |
41 | argument of name C<loop> (which is always of type C<struct ev_loop *>) |
41 | argument of name C<loop> (which is always of type C<struct ev_loop *>) |
42 | will not have this argument. |
42 | will not have this argument. |
43 | |
43 | |
44 | =head1 TIME AND OTHER GLOBAL FUNCTIONS |
44 | =head1 TIME REPRESENTATION |
45 | |
45 | |
46 | Libev represents time as a single floating point number, representing the |
46 | Libev represents time as a single floating point number, representing the |
47 | (fractional) number of seconds since the (POSIX) epoch (somewhere near |
47 | (fractional) number of seconds since the (POSIX) epoch (somewhere near |
48 | the beginning of 1970, details are complicated, don't ask). This type is |
48 | the beginning of 1970, details are complicated, don't ask). This type is |
49 | called C<ev_tstamp>, which is what you should use too. It usually aliases |
49 | called C<ev_tstamp>, which is what you should use too. It usually aliases |
50 | to the double type in C. |
50 | to the double type in C. |
|
|
51 | |
|
|
52 | =head1 GLOBAL FUNCTIONS |
51 | |
53 | |
52 | =over 4 |
54 | =over 4 |
53 | |
55 | |
54 | =item ev_tstamp ev_time () |
56 | =item ev_tstamp ev_time () |
55 | |
57 | |
… | |
… | |
99 | An event loop is described by a C<struct ev_loop *>. The library knows two |
101 | An event loop is described by a C<struct ev_loop *>. The library knows two |
100 | types of such loops, the I<default> loop, which supports signals and child |
102 | types of such loops, the I<default> loop, which supports signals and child |
101 | events, and dynamically created loops which do not. |
103 | events, and dynamically created loops which do not. |
102 | |
104 | |
103 | If you use threads, a common model is to run the default event loop |
105 | If you use threads, a common model is to run the default event loop |
104 | in your main thread (or in a separate thrad) and for each thread you |
106 | in your main thread (or in a separate thread) and for each thread you |
105 | create, you also create another event loop. Libev itself does no locking |
107 | create, you also create another event loop. Libev itself does no locking |
106 | whatsoever, so if you mix calls to the same event loop in different |
108 | whatsoever, so if you mix calls to the same event loop in different |
107 | threads, make sure you lock (this is usually a bad idea, though, even if |
109 | threads, make sure you lock (this is usually a bad idea, though, even if |
108 | done correctly, because it's hideous and inefficient). |
110 | done correctly, because it's hideous and inefficient). |
109 | |
111 | |