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

Comparing libev/ev.pod (file contents):
Revision 1.306 by root, Mon Oct 18 07:36:05 2010 UTC vs.
Revision 1.309 by root, Thu Oct 21 09:23:21 2010 UTC

954These two functions can be used to associate arbitrary data with a loop, 954These two functions can be used to associate arbitrary data with a loop,
955and are intended solely for the C<invoke_pending_cb>, C<release> and 955and are intended solely for the C<invoke_pending_cb>, C<release> and
956C<acquire> callbacks described above, but of course can be (ab-)used for 956C<acquire> callbacks described above, but of course can be (ab-)used for
957any other purpose as well. 957any other purpose as well.
958 958
959=item ev_loop_verify (loop) 959=item ev_verify (loop)
960 960
961This function only does something when C<EV_VERIFY> support has been 961This function only does something when C<EV_VERIFY> support has been
962compiled in, which is the default for non-minimal builds. It tries to go 962compiled in, which is the default for non-minimal builds. It tries to go
963through all internal structures and checks them for validity. If anything 963through all internal structures and checks them for validity. If anything
964is found to be inconsistent, it will print an error message to standard 964is found to be inconsistent, it will print an error message to standard
3391Associates a different C<struct ev_loop> with this watcher. You can only 3391Associates a different C<struct ev_loop> with this watcher. You can only
3392do this when the watcher is inactive (and not pending either). 3392do this when the watcher is inactive (and not pending either).
3393 3393
3394=item w->set ([arguments]) 3394=item w->set ([arguments])
3395 3395
3396Basically the same as C<ev_TYPE_set>, with the same arguments. Must be 3396Basically the same as C<ev_TYPE_set>, with the same arguments. Either this
3397called at least once. Unlike the C counterpart, an active watcher gets 3397method or a suitable start method must be called at least once. Unlike the
3398automatically stopped and restarted when reconfiguring it with this 3398C counterpart, an active watcher gets automatically stopped and restarted
3399method. 3399when reconfiguring it with this method.
3400 3400
3401=item w->start () 3401=item w->start ()
3402 3402
3403Starts the watcher. Note that there is no C<loop> argument, as the 3403Starts the watcher. Note that there is no C<loop> argument, as the
3404constructor already stores the event loop. 3404constructor already stores the event loop.
3405 3405
3406=item w->start ([arguments])
3407
3408Instead of calling C<set> and C<start> methods separately, it is often
3409convenient to wrap them in one call. Uses the same type of arguments as
3410the configure C<set> method of the watcher.
3411
3406=item w->stop () 3412=item w->stop ()
3407 3413
3408Stops the watcher if it is active. Again, no C<loop> argument. 3414Stops the watcher if it is active. Again, no C<loop> argument.
3409 3415
3410=item w->again () (C<ev::timer>, C<ev::periodic> only) 3416=item w->again () (C<ev::timer>, C<ev::periodic> only)
3422 3428
3423=back 3429=back
3424 3430
3425=back 3431=back
3426 3432
3427Example: Define a class with an IO and idle watcher, start one of them in 3433Example: Define a class with two I/O and idle watchers, start the I/O
3428the constructor. 3434watchers in the constructor.
3429 3435
3430 class myclass 3436 class myclass
3431 { 3437 {
3432 ev::io io ; void io_cb (ev::io &w, int revents); 3438 ev::io io ; void io_cb (ev::io &w, int revents);
3439 ev::io2 io2 ; void io2_cb (ev::io &w, int revents);
3433 ev::idle idle; void idle_cb (ev::idle &w, int revents); 3440 ev::idle idle; void idle_cb (ev::idle &w, int revents);
3434 3441
3435 myclass (int fd) 3442 myclass (int fd)
3436 { 3443 {
3437 io .set <myclass, &myclass::io_cb > (this); 3444 io .set <myclass, &myclass::io_cb > (this);
3445 io2 .set <myclass, &myclass::io2_cb > (this);
3438 idle.set <myclass, &myclass::idle_cb> (this); 3446 idle.set <myclass, &myclass::idle_cb> (this);
3439 3447
3440 io.start (fd, ev::READ); 3448 io.set (fd, ev::WRITE); // configure the watcher
3449 io.start (); // start it whenever convenient
3450
3451 io2.start (fd, ev::READ); // set + start in one call
3441 } 3452 }
3442 }; 3453 };
3443 3454
3444 3455
3445=head1 OTHER LANGUAGE BINDINGS 3456=head1 OTHER LANGUAGE BINDINGS
4029The default is C<1>, unless C<EV_FEATURES> overrides it, in which case it 4040The default is C<1>, unless C<EV_FEATURES> overrides it, in which case it
4030will be C<0>. 4041will be C<0>.
4031 4042
4032=item EV_VERIFY 4043=item EV_VERIFY
4033 4044
4034Controls how much internal verification (see C<ev_loop_verify ()>) will 4045Controls how much internal verification (see C<ev_verify ()>) will
4035be done: If set to C<0>, no internal verification code will be compiled 4046be done: If set to C<0>, no internal verification code will be compiled
4036in. If set to C<1>, then verification code will be compiled in, but not 4047in. If set to C<1>, then verification code will be compiled in, but not
4037called. If set to C<2>, then the internal verification code will be 4048called. If set to C<2>, then the internal verification code will be
4038called once per loop, which can slow down libev. If set to C<3>, then the 4049called once per loop, which can slow down libev. If set to C<3>, then the
4039verification code will be called very frequently, which will slow down 4050verification code will be called very frequently, which will slow down
4626watchers. 4637watchers.
4627 4638
4628=item C<double> must hold a time value in seconds with enough accuracy 4639=item C<double> must hold a time value in seconds with enough accuracy
4629 4640
4630The type C<double> is used to represent timestamps. It is required to 4641The type C<double> is used to represent timestamps. It is required to
4631have at least 51 bits of mantissa (and 9 bits of exponent), which is good 4642have at least 51 bits of mantissa (and 9 bits of exponent), which is
4632enough for at least into the year 4000. This requirement is fulfilled by 4643good enough for at least into the year 4000 with millisecond accuracy
4644(the design goal for libev). This requirement is overfulfilled by
4633implementations implementing IEEE 754, which is basically all existing 4645implementations using IEEE 754, which is basically all existing ones. With
4634ones. With IEEE 754 doubles, you get microsecond accuracy until at least 4646IEEE 754 doubles, you get microsecond accuracy until at least 2200.
46352200.
4636 4647
4637=back 4648=back
4638 4649
4639If you know of other additional requirements drop me a note. 4650If you know of other additional requirements drop me a note.
4640 4651

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines