… | |
… | |
567 | |
567 | |
568 | It scales in the same way as the epoll backend, but the interface to the |
568 | It scales in the same way as the epoll backend, but the interface to the |
569 | kernel is more efficient (which says nothing about its actual speed, of |
569 | kernel is more efficient (which says nothing about its actual speed, of |
570 | course). While stopping, setting and starting an I/O watcher does never |
570 | course). While stopping, setting and starting an I/O watcher does never |
571 | cause an extra system call as with C<EVBACKEND_EPOLL>, it still adds up to |
571 | cause an extra system call as with C<EVBACKEND_EPOLL>, it still adds up to |
572 | two event changes per incident. Support for C<fork ()> is very bad (but |
572 | two event changes per incident. Support for C<fork ()> is very bad (you |
573 | sane, unlike epoll) and it drops fds silently in similarly hard-to-detect |
573 | might have to leak fd's on fork, but it's more sane than epoll) and it |
574 | cases |
574 | drops fds silently in similarly hard-to-detect cases |
575 | |
575 | |
576 | This backend usually performs well under most conditions. |
576 | This backend usually performs well under most conditions. |
577 | |
577 | |
578 | While nominally embeddable in other event loops, this doesn't work |
578 | While nominally embeddable in other event loops, this doesn't work |
579 | everywhere, so you might need to test for this. And since it is broken |
579 | everywhere, so you might need to test for this. And since it is broken |
… | |
… | |
3917 | with C<operator ()> can be used as callbacks. Other types should be easy |
3917 | with C<operator ()> can be used as callbacks. Other types should be easy |
3918 | to add as long as they only need one additional pointer for context. If |
3918 | to add as long as they only need one additional pointer for context. If |
3919 | you need support for other types of functors please contact the author |
3919 | you need support for other types of functors please contact the author |
3920 | (preferably after implementing it). |
3920 | (preferably after implementing it). |
3921 | |
3921 | |
|
|
3922 | For all this to work, your C++ compiler either has to use the same calling |
|
|
3923 | conventions as your C compiler (for static member functions), or you have |
|
|
3924 | to embed libev and compile libev itself as C++. |
|
|
3925 | |
3922 | Here is a list of things available in the C<ev> namespace: |
3926 | Here is a list of things available in the C<ev> namespace: |
3923 | |
3927 | |
3924 | =over 4 |
3928 | =over 4 |
3925 | |
3929 | |
3926 | =item C<ev::READ>, C<ev::WRITE> etc. |
3930 | =item C<ev::READ>, C<ev::WRITE> etc. |
… | |
… | |
4504 | If defined to be C<1>, libev will compile in support for the Linux inotify |
4508 | If defined to be C<1>, libev will compile in support for the Linux inotify |
4505 | interface to speed up C<ev_stat> watchers. Its actual availability will |
4509 | interface to speed up C<ev_stat> watchers. Its actual availability will |
4506 | be detected at runtime. If undefined, it will be enabled if the headers |
4510 | be detected at runtime. If undefined, it will be enabled if the headers |
4507 | indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled. |
4511 | indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled. |
4508 | |
4512 | |
|
|
4513 | =item EV_NO_SMP |
|
|
4514 | |
|
|
4515 | If defined to be C<1>, libev will assume that memory is always coherent |
|
|
4516 | between threads, that is, threads can be used, but threads never run on |
|
|
4517 | different cpus (or different cpu cores). This reduces dependencies |
|
|
4518 | and makes libev faster. |
|
|
4519 | |
|
|
4520 | =item EV_NO_THREADS |
|
|
4521 | |
|
|
4522 | If defined to be C<1>, libev will assume that it will never be called |
|
|
4523 | from different threads, which is a stronger assumption than C<EV_NO_SMP>, |
|
|
4524 | above. This reduces dependencies and makes libev faster. |
|
|
4525 | |
4509 | =item EV_ATOMIC_T |
4526 | =item EV_ATOMIC_T |
4510 | |
4527 | |
4511 | Libev requires an integer type (suitable for storing C<0> or C<1>) whose |
4528 | Libev requires an integer type (suitable for storing C<0> or C<1>) whose |
4512 | access is atomic and serialised with respect to other threads or signal |
4529 | access is atomic and serialised with respect to other threads or signal |
4513 | contexts. No such type is easily found in the C language, so you can |
4530 | contexts. No such type is easily found in the C language, so you can |