… | |
… | |
908 | |
908 | |
909 | =item ev_invoke_pending (loop) |
909 | =item ev_invoke_pending (loop) |
910 | |
910 | |
911 | This call will simply invoke all pending watchers while resetting their |
911 | This call will simply invoke all pending watchers while resetting their |
912 | pending state. Normally, C<ev_run> does this automatically when required, |
912 | pending state. Normally, C<ev_run> does this automatically when required, |
913 | but when overriding the invoke callback this call comes handy. |
913 | but when overriding the invoke callback this call comes handy. This |
|
|
914 | function can be invoked from a watcher - this can be useful for example |
|
|
915 | when you want to do some lengthy calculation and want to pass further |
|
|
916 | event handling to another thread (you still have to make sure only one |
|
|
917 | thread executes within C<ev_invoke_pending> or C<ev_run> of course). |
914 | |
918 | |
915 | =item int ev_pending_count (loop) |
919 | =item int ev_pending_count (loop) |
916 | |
920 | |
917 | Returns the number of pending watchers - zero indicates that no watchers |
921 | Returns the number of pending watchers - zero indicates that no watchers |
918 | are pending. |
922 | are pending. |
… | |
… | |
1159 | and call libev functions on it that are documented to work on active watchers. |
1163 | and call libev functions on it that are documented to work on active watchers. |
1160 | |
1164 | |
1161 | =item pending |
1165 | =item pending |
1162 | |
1166 | |
1163 | If a watcher is active and libev determines that an event it is interested |
1167 | If a watcher is active and libev determines that an event it is interested |
1164 | in has occured (such as a timer expiring), it will become pending. It will |
1168 | in has occurred (such as a timer expiring), it will become pending. It will |
1165 | stay in this pending state until either it is stopped or its callback is |
1169 | stay in this pending state until either it is stopped or its callback is |
1166 | about to be invoked, so it is not normally pending inside the watcher |
1170 | about to be invoked, so it is not normally pending inside the watcher |
1167 | callback. |
1171 | callback. |
1168 | |
1172 | |
1169 | The watcher might or might not be active while it is pending (for example, |
1173 | The watcher might or might not be active while it is pending (for example, |
… | |
… | |
4527 | =head3 C<kqueue> is buggy |
4531 | =head3 C<kqueue> is buggy |
4528 | |
4532 | |
4529 | The kqueue syscall is broken in all known versions - most versions support |
4533 | The kqueue syscall is broken in all known versions - most versions support |
4530 | only sockets, many support pipes. |
4534 | only sockets, many support pipes. |
4531 | |
4535 | |
4532 | Libev tries to work around this by not using C<kqueue> by default on |
4536 | Libev tries to work around this by not using C<kqueue> by default on this |
4533 | this rotten platform, but of course you can still ask for it when creating |
4537 | rotten platform, but of course you can still ask for it when creating a |
4534 | a loop. |
4538 | loop - embedding a socket-only kqueue loop into a select-based one is |
|
|
4539 | probably going to work well. |
4535 | |
4540 | |
4536 | =head3 C<poll> is buggy |
4541 | =head3 C<poll> is buggy |
4537 | |
4542 | |
4538 | Instead of fixing C<kqueue>, Apple replaced their (working) C<poll> |
4543 | Instead of fixing C<kqueue>, Apple replaced their (working) C<poll> |
4539 | implementation by something calling C<kqueue> internally around the 10.5.6 |
4544 | implementation by something calling C<kqueue> internally around the 10.5.6 |
… | |
… | |
4558 | |
4563 | |
4559 | =head3 C<errno> reentrancy |
4564 | =head3 C<errno> reentrancy |
4560 | |
4565 | |
4561 | The default compile environment on Solaris is unfortunately so |
4566 | The default compile environment on Solaris is unfortunately so |
4562 | thread-unsafe that you can't even use components/libraries compiled |
4567 | thread-unsafe that you can't even use components/libraries compiled |
4563 | without C<-D_REENTRANT> (as long as they use C<errno>), which, of course, |
4568 | without C<-D_REENTRANT> in a threaded program, which, of course, isn't |
4564 | isn't defined by default. |
4569 | defined by default. A valid, if stupid, implementation choice. |
4565 | |
4570 | |
4566 | If you want to use libev in threaded environments you have to make sure |
4571 | If you want to use libev in threaded environments you have to make sure |
4567 | it's compiled with C<_REENTRANT> defined. |
4572 | it's compiled with C<_REENTRANT> defined. |
4568 | |
4573 | |
4569 | =head3 Event port backend |
4574 | =head3 Event port backend |
4570 | |
4575 | |
4571 | The scalable event interface for Solaris is called "event ports". Unfortunately, |
4576 | The scalable event interface for Solaris is called "event |
4572 | this mechanism is very buggy. If you run into high CPU usage, your program |
4577 | ports". Unfortunately, this mechanism is very buggy in all major |
|
|
4578 | releases. If you run into high CPU usage, your program freezes or you get |
4573 | freezes or you get a large number of spurious wakeups, make sure you have |
4579 | a large number of spurious wakeups, make sure you have all the relevant |
4574 | all the relevant and latest kernel patches applied. No, I don't know which |
4580 | and latest kernel patches applied. No, I don't know which ones, but there |
4575 | ones, but there are multiple ones. |
4581 | are multiple ones to apply, and afterwards, event ports actually work |
|
|
4582 | great. |
4576 | |
4583 | |
4577 | If you can't get it to work, you can try running the program by setting |
4584 | If you can't get it to work, you can try running the program by setting |
4578 | the environment variable C<LIBEV_FLAGS=3> to only allow C<poll> and |
4585 | the environment variable C<LIBEV_FLAGS=3> to only allow C<poll> and |
4579 | C<select> backends. |
4586 | C<select> backends. |
4580 | |
4587 | |
4581 | =head2 AIX POLL BUG |
4588 | =head2 AIX POLL BUG |
4582 | |
4589 | |
4583 | AIX unfortunately has a broken C<poll.h> header. Libev works around |
4590 | AIX unfortunately has a broken C<poll.h> header. Libev works around |
4584 | this by trying to avoid the poll backend altogether (i.e. it's not even |
4591 | this by trying to avoid the poll backend altogether (i.e. it's not even |
4585 | compiled in), which normally isn't a big problem as C<select> works fine |
4592 | compiled in), which normally isn't a big problem as C<select> works fine |
4586 | with large bitsets, and AIX is dead anyway. |
4593 | with large bitsets on AIX, and AIX is dead anyway. |
4587 | |
4594 | |
4588 | =head2 WIN32 PLATFORM LIMITATIONS AND WORKAROUNDS |
4595 | =head2 WIN32 PLATFORM LIMITATIONS AND WORKAROUNDS |
4589 | |
4596 | |
4590 | =head3 General issues |
4597 | =head3 General issues |
4591 | |
4598 | |