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

Comparing libev/ev.3 (file contents):
Revision 1.108 by root, Sat Jul 28 04:15:15 2018 UTC vs.
Revision 1.111 by root, Sun Jun 23 02:02:24 2019 UTC

1.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) 1.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
2.\" 2.\"
3.\" Standard preamble: 3.\" Standard preamble:
4.\" ======================================================================== 4.\" ========================================================================
5.de Sp \" Vertical space (when we can't use .PP) 5.de Sp \" Vertical space (when we can't use .PP)
6.if t .sp .5v 6.if t .sp .5v
44.\" 44.\"
45.\" Escape single quotes in literal strings from groff's Unicode transform. 45.\" Escape single quotes in literal strings from groff's Unicode transform.
46.ie \n(.g .ds Aq \(aq 46.ie \n(.g .ds Aq \(aq
47.el .ds Aq ' 47.el .ds Aq '
48.\" 48.\"
49.\" If the F register is turned on, we'll generate index entries on stderr for 49.\" If the F register is >0, we'll generate index entries on stderr for
50.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index 50.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51.\" entries marked with X<> in POD. Of course, you'll have to process the 51.\" entries marked with X<> in POD. Of course, you'll have to process the
52.\" output yourself in some meaningful fashion. 52.\" output yourself in some meaningful fashion.
53.\" 53.\"
54.\" Avoid warning from groff about undefined register 'F'. 54.\" Avoid warning from groff about undefined register 'F'.
55.de IX 55.de IX
56.. 56..
57.nr rF 0 57.nr rF 0
58.if \n(.g .if rF .nr rF 1 58.if \n(.g .if rF .nr rF 1
59.if (\n(rF:(\n(.g==0)) \{ 59.if (\n(rF:(\n(.g==0)) \{\
60. if \nF \{ 60. if \nF \{\
61. de IX 61. de IX
62. tm Index:\\$1\t\\n%\t"\\$2" 62. tm Index:\\$1\t\\n%\t"\\$2"
63.. 63..
64. if !\nF==2 \{ 64. if !\nF==2 \{\
65. nr % 0 65. nr % 0
66. nr F 2 66. nr F 2
67. \} 67. \}
68. \} 68. \}
69.\} 69.\}
131.\} 131.\}
132.rm #[ #] #H #V #F C 132.rm #[ #] #H #V #F C
133.\" ======================================================================== 133.\" ========================================================================
134.\" 134.\"
135.IX Title "LIBEV 3" 135.IX Title "LIBEV 3"
136.TH LIBEV 3 "2017-11-14" "libev-4.24" "libev - high performance full featured event loop" 136.TH LIBEV 3 "2019-06-22" "libev-4.25" "libev - high performance full featured event loop"
137.\" For nroff, turn off justification. Always turn off hyphenation; it makes 137.\" For nroff, turn off justification. Always turn off hyphenation; it makes
138.\" way too many mistakes in technical documents. 138.\" way too many mistakes in technical documents.
139.if n .ad l 139.if n .ad l
140.nh 140.nh
141.SH "NAME" 141.SH "NAME"
240watchers\fR, which are relatively small C structures you initialise with the 240watchers\fR, which are relatively small C structures you initialise with the
241details of the event, and then hand it over to libev by \fIstarting\fR the 241details of the event, and then hand it over to libev by \fIstarting\fR the
242watcher. 242watcher.
243.SS "\s-1FEATURES\s0" 243.SS "\s-1FEATURES\s0"
244.IX Subsection "FEATURES" 244.IX Subsection "FEATURES"
245Libev supports \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, the Linux-specific \f(CW\*(C`epoll\*(C'\fR, the 245Libev supports \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`poll\*(C'\fR, the Linux-specific aio and \f(CW\*(C`epoll\*(C'\fR
246BSD-specific \f(CW\*(C`kqueue\*(C'\fR and the Solaris-specific event port mechanisms 246interfaces, the BSD-specific \f(CW\*(C`kqueue\*(C'\fR and the Solaris-specific event port
247for file descriptor events (\f(CW\*(C`ev_io\*(C'\fR), the Linux \f(CW\*(C`inotify\*(C'\fR interface 247mechanisms for file descriptor events (\f(CW\*(C`ev_io\*(C'\fR), the Linux \f(CW\*(C`inotify\*(C'\fR
248(for \f(CW\*(C`ev_stat\*(C'\fR), Linux eventfd/signalfd (for faster and cleaner 248interface (for \f(CW\*(C`ev_stat\*(C'\fR), Linux eventfd/signalfd (for faster and cleaner
249inter-thread wakeup (\f(CW\*(C`ev_async\*(C'\fR)/signal handling (\f(CW\*(C`ev_signal\*(C'\fR)) relative 249inter-thread wakeup (\f(CW\*(C`ev_async\*(C'\fR)/signal handling (\f(CW\*(C`ev_signal\*(C'\fR)) relative
250timers (\f(CW\*(C`ev_timer\*(C'\fR), absolute timers with customised rescheduling 250timers (\f(CW\*(C`ev_timer\*(C'\fR), absolute timers with customised rescheduling
251(\f(CW\*(C`ev_periodic\*(C'\fR), synchronous signals (\f(CW\*(C`ev_signal\*(C'\fR), process status 251(\f(CW\*(C`ev_periodic\*(C'\fR), synchronous signals (\f(CW\*(C`ev_signal\*(C'\fR), process status
252change events (\f(CW\*(C`ev_child\*(C'\fR), and event watchers dealing with the event 252change events (\f(CW\*(C`ev_child\*(C'\fR), and event watchers dealing with the event
253loop mechanism itself (\f(CW\*(C`ev_idle\*(C'\fR, \f(CW\*(C`ev_embed\*(C'\fR, \f(CW\*(C`ev_prepare\*(C'\fR and 253loop mechanism itself (\f(CW\*(C`ev_idle\*(C'\fR, \f(CW\*(C`ev_embed\*(C'\fR, \f(CW\*(C`ev_prepare\*(C'\fR and
392.Sp 392.Sp
393You could override this function in high-availability programs to, say, 393You could override this function in high-availability programs to, say,
394free some memory if it cannot allocate memory, to use a special allocator, 394free some memory if it cannot allocate memory, to use a special allocator,
395or even to sleep a while and retry until some memory is available. 395or even to sleep a while and retry until some memory is available.
396.Sp 396.Sp
397Example: The following is the \f(CW\*(C`realloc\*(C'\fR function that libev itself uses
398which should work with \f(CW\*(C`realloc\*(C'\fR and \f(CW\*(C`free\*(C'\fR functions of all kinds and
399is probably a good basis for your own implementation.
400.Sp
401.Vb 5
402\& static void *
403\& ev_realloc_emul (void *ptr, long size) EV_NOEXCEPT
404\& {
405\& if (size)
406\& return realloc (ptr, size);
407\&
408\& free (ptr);
409\& return 0;
410\& }
411.Ve
412.Sp
397Example: Replace the libev allocator with one that waits a bit and then 413Example: Replace the libev allocator with one that waits a bit and then
398retries (example requires a standards-compliant \f(CW\*(C`realloc\*(C'\fR). 414retries.
399.Sp 415.Sp
400.Vb 6 416.Vb 8
401\& static void * 417\& static void *
402\& persistent_realloc (void *ptr, size_t size) 418\& persistent_realloc (void *ptr, size_t size)
403\& { 419\& {
420\& if (!size)
421\& {
422\& free (ptr);
423\& return 0;
424\& }
425\&
404\& for (;;) 426\& for (;;)
405\& { 427\& {
406\& void *newptr = realloc (ptr, size); 428\& void *newptr = realloc (ptr, size);
407\& 429\&
408\& if (newptr) 430\& if (newptr)
585.Sp 607.Sp
586This flag's behaviour will become the default in future versions of libev. 608This flag's behaviour will become the default in future versions of libev.
587.ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4 609.ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4
588.el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4 610.el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4
589.IX Item "EVBACKEND_SELECT (value 1, portable select backend)" 611.IX Item "EVBACKEND_SELECT (value 1, portable select backend)"
590This is your standard \fIselect\fR\|(2) backend. Not \fIcompletely\fR standard, as 612This is your standard \fBselect\fR\|(2) backend. Not \fIcompletely\fR standard, as
591libev tries to roll its own fd_set with no limits on the number of fds, 613libev tries to roll its own fd_set with no limits on the number of fds,
592but if that fails, expect a fairly low limit on the number of fds when 614but if that fails, expect a fairly low limit on the number of fds when
593using this backend. It doesn't scale too well (O(highest_fd)), but its 615using this backend. It doesn't scale too well (O(highest_fd)), but its
594usually the fastest backend for a low number of (low-numbered :) fds. 616usually the fastest backend for a low number of (low-numbered :) fds.
595.Sp 617.Sp
604\&\f(CW\*(C`writefds\*(C'\fR set (and to work around Microsoft Windows bugs, also onto the 626\&\f(CW\*(C`writefds\*(C'\fR set (and to work around Microsoft Windows bugs, also onto the
605\&\f(CW\*(C`exceptfds\*(C'\fR set on that platform). 627\&\f(CW\*(C`exceptfds\*(C'\fR set on that platform).
606.ie n .IP """EVBACKEND_POLL"" (value 2, poll backend, available everywhere except on windows)" 4 628.ie n .IP """EVBACKEND_POLL"" (value 2, poll backend, available everywhere except on windows)" 4
607.el .IP "\f(CWEVBACKEND_POLL\fR (value 2, poll backend, available everywhere except on windows)" 4 629.el .IP "\f(CWEVBACKEND_POLL\fR (value 2, poll backend, available everywhere except on windows)" 4
608.IX Item "EVBACKEND_POLL (value 2, poll backend, available everywhere except on windows)" 630.IX Item "EVBACKEND_POLL (value 2, poll backend, available everywhere except on windows)"
609And this is your standard \fIpoll\fR\|(2) backend. It's more complicated 631And this is your standard \fBpoll\fR\|(2) backend. It's more complicated
610than select, but handles sparse fds better and has no artificial 632than select, but handles sparse fds better and has no artificial
611limit on the number of fds you can use (except it will slow down 633limit on the number of fds you can use (except it will slow down
612considerably with a lot of inactive fds). It scales similarly to select, 634considerably with a lot of inactive fds). It scales similarly to select,
613i.e. O(total_fds). See the entry for \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR, above, for 635i.e. O(total_fds). See the entry for \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR, above, for
614performance tips. 636performance tips.
616This backend maps \f(CW\*(C`EV_READ\*(C'\fR to \f(CW\*(C`POLLIN | POLLERR | POLLHUP\*(C'\fR, and 638This backend maps \f(CW\*(C`EV_READ\*(C'\fR to \f(CW\*(C`POLLIN | POLLERR | POLLHUP\*(C'\fR, and
617\&\f(CW\*(C`EV_WRITE\*(C'\fR to \f(CW\*(C`POLLOUT | POLLERR | POLLHUP\*(C'\fR. 639\&\f(CW\*(C`EV_WRITE\*(C'\fR to \f(CW\*(C`POLLOUT | POLLERR | POLLHUP\*(C'\fR.
618.ie n .IP """EVBACKEND_EPOLL"" (value 4, Linux)" 4 640.ie n .IP """EVBACKEND_EPOLL"" (value 4, Linux)" 4
619.el .IP "\f(CWEVBACKEND_EPOLL\fR (value 4, Linux)" 4 641.el .IP "\f(CWEVBACKEND_EPOLL\fR (value 4, Linux)" 4
620.IX Item "EVBACKEND_EPOLL (value 4, Linux)" 642.IX Item "EVBACKEND_EPOLL (value 4, Linux)"
621Use the linux-specific \fIepoll\fR\|(7) interface (for both pre\- and post\-2.6.9 643Use the linux-specific \fBepoll\fR\|(7) interface (for both pre\- and post\-2.6.9
622kernels). 644kernels).
623.Sp 645.Sp
624For few fds, this backend is a bit little slower than poll and select, but 646For few fds, this backend is a bit little slower than poll and select, but
625it scales phenomenally better. While poll and select usually scale like 647it scales phenomenally better. While poll and select usually scale like
626O(total_fds) where total_fds is the total number of fds (or the highest 648O(total_fds) where total_fds is the total number of fds (or the highest
672All this means that, in practice, \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR can be as fast or 694All this means that, in practice, \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR can be as fast or
673faster than epoll for maybe up to a hundred file descriptors, depending on 695faster than epoll for maybe up to a hundred file descriptors, depending on
674the usage. So sad. 696the usage. So sad.
675.Sp 697.Sp
676While nominally embeddable in other event loops, this feature is broken in 698While nominally embeddable in other event loops, this feature is broken in
677all kernel versions tested so far. 699a lot of kernel revisions, but probably(!) works in current versions.
700.Sp
701This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as
702\&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR.
703.ie n .IP """EVBACKEND_LINUXAIO"" (value 64, Linux)" 4
704.el .IP "\f(CWEVBACKEND_LINUXAIO\fR (value 64, Linux)" 4
705.IX Item "EVBACKEND_LINUXAIO (value 64, Linux)"
706Use the linux-specific linux aio (\fInot\fR \f(CWaio(7)\fR) event interface
707available in post\-4.18 kernels.
708.Sp
709If this backend works for you (as of this writing, it was very
710experimental and only supports a subset of file types), it is the best
711event interface available on linux and might be well worth it enabling it
712\&\- if it isn't available in your kernel this will be detected and another
713backend will be chosen.
714.Sp
715This backend can batch oneshot requests and uses a user-space ring buffer
716to receive events. It also doesn't suffer from most of the design problems
717of epoll (such as not being able to remove event sources from the epoll
718set), and generally sounds too good to be true. Because, this being the
719linux kernel, of course it suffers from a whole new set of limitations.
720.Sp
721For one, it is not easily embeddable (but probably could be done using
722an event fd at some extra overhead). It also is subject to various
723arbitrary limits that can be configured in \fI/proc/sys/fs/aio\-max\-nr\fR
724and \fI/proc/sys/fs/aio\-nr\fR), which could lead to it being skipped during
725initialisation.
726.Sp
727Most problematic in practise, however, is that, like kqueue, it requires
728special support from drivers, and, not surprisingly, not all drivers
729implement it. For example, in linux 4.19, tcp sockets, pipes, event fds,
730files, \fI/dev/null\fR and a few others are supported, but ttys are not, so
731this is not (yet?) a generic event polling interface but is probably still
732be very useful in a web server or similar program.
678.Sp 733.Sp
679This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as 734This backend maps \f(CW\*(C`EV_READ\*(C'\fR and \f(CW\*(C`EV_WRITE\*(C'\fR in the same way as
680\&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR. 735\&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR.
681.ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4 736.ie n .IP """EVBACKEND_KQUEUE"" (value 8, most \s-1BSD\s0 clones)" 4
682.el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4 737.el .IP "\f(CWEVBACKEND_KQUEUE\fR (value 8, most \s-1BSD\s0 clones)" 4
785Example: Use whatever libev has to offer, but make sure that kqueue is 840Example: Use whatever libev has to offer, but make sure that kqueue is
786used if available. 841used if available.
787.Sp 842.Sp
788.Vb 1 843.Vb 1
789\& struct ev_loop *loop = ev_loop_new (ev_recommended_backends () | EVBACKEND_KQUEUE); 844\& struct ev_loop *loop = ev_loop_new (ev_recommended_backends () | EVBACKEND_KQUEUE);
845.Ve
846.Sp
847Example: Similarly, on linux, you mgiht want to take advantage of the
848linux aio backend if possible, but fall back to something else if that
849isn't available.
850.Sp
851.Vb 1
852\& struct ev_loop *loop = ev_loop_new (ev_recommended_backends () | EVBACKEND_LINUXAIO);
790.Ve 853.Ve
791.RE 854.RE
792.IP "ev_loop_destroy (loop)" 4 855.IP "ev_loop_destroy (loop)" 4
793.IX Item "ev_loop_destroy (loop)" 856.IX Item "ev_loop_destroy (loop)"
794Destroys an event loop object (frees all memory and kernel state 857Destroys an event loop object (frees all memory and kernel state
1365bug in your program. 1428bug in your program.
1366.Sp 1429.Sp
1367Libev will usually signal a few \*(L"dummy\*(R" events together with an error, for 1430Libev will usually signal a few \*(L"dummy\*(R" events together with an error, for
1368example it might indicate that a fd is readable or writable, and if your 1431example it might indicate that a fd is readable or writable, and if your
1369callbacks is well-written it can just attempt the operation and cope with 1432callbacks is well-written it can just attempt the operation and cope with
1370the error from \fIread()\fR or \fIwrite()\fR. This will not work in multi-threaded 1433the error from \fBread()\fR or \fBwrite()\fR. This will not work in multi-threaded
1371programs, though, as the fd could already be closed and reused for another 1434programs, though, as the fd could already be closed and reused for another
1372thing, so beware. 1435thing, so beware.
1373.SS "\s-1GENERIC WATCHER FUNCTIONS\s0" 1436.SS "\s-1GENERIC WATCHER FUNCTIONS\s0"
1374.IX Subsection "GENERIC WATCHER FUNCTIONS" 1437.IX Subsection "GENERIC WATCHER FUNCTIONS"
1375.ie n .IP """ev_init"" (ev_TYPE *watcher, callback)" 4 1438.ie n .IP """ev_init"" (ev_TYPE *watcher, callback)" 4
1726But really, best use non-blocking mode. 1789But really, best use non-blocking mode.
1727.PP 1790.PP
1728\fIThe special problem of disappearing file descriptors\fR 1791\fIThe special problem of disappearing file descriptors\fR
1729.IX Subsection "The special problem of disappearing file descriptors" 1792.IX Subsection "The special problem of disappearing file descriptors"
1730.PP 1793.PP
1731Some backends (e.g. kqueue, epoll) need to be told about closing a file 1794Some backends (e.g. kqueue, epoll, linuxaio) need to be told about closing
1732descriptor (either due to calling \f(CW\*(C`close\*(C'\fR explicitly or any other means, 1795a file descriptor (either due to calling \f(CW\*(C`close\*(C'\fR explicitly or any other
1733such as \f(CW\*(C`dup2\*(C'\fR). The reason is that you register interest in some file 1796means, such as \f(CW\*(C`dup2\*(C'\fR). The reason is that you register interest in some
1734descriptor, but when it goes away, the operating system will silently drop 1797file descriptor, but when it goes away, the operating system will silently
1735this interest. If another file descriptor with the same number then is 1798drop this interest. If another file descriptor with the same number then
1736registered with libev, there is no efficient way to see that this is, in 1799is registered with libev, there is no efficient way to see that this is,
1737fact, a different file descriptor. 1800in fact, a different file descriptor.
1738.PP 1801.PP
1739To avoid having to explicitly tell libev about such cases, libev follows 1802To avoid having to explicitly tell libev about such cases, libev follows
1740the following policy: Each time \f(CW\*(C`ev_io_set\*(C'\fR is being called, libev 1803the following policy: Each time \f(CW\*(C`ev_io_set\*(C'\fR is being called, libev
1741will assume that this is potentially a new file descriptor, otherwise 1804will assume that this is potentially a new file descriptor, otherwise
1742it is assumed that the file descriptor stays the same. That means that 1805it is assumed that the file descriptor stays the same. That means that
1794reuse the same code path. 1857reuse the same code path.
1795.PP 1858.PP
1796\fIThe special problem of fork\fR 1859\fIThe special problem of fork\fR
1797.IX Subsection "The special problem of fork" 1860.IX Subsection "The special problem of fork"
1798.PP 1861.PP
1799Some backends (epoll, kqueue) do not support \f(CW\*(C`fork ()\*(C'\fR at all or exhibit 1862Some backends (epoll, kqueue, probably linuxaio) do not support \f(CW\*(C`fork ()\*(C'\fR
1800useless behaviour. Libev fully supports fork, but needs to be told about 1863at all or exhibit useless behaviour. Libev fully supports fork, but needs
1801it in the child if you want to continue to use it in the child. 1864to be told about it in the child if you want to continue to use it in the
1865child.
1802.PP 1866.PP
1803To support fork in your child processes, you have to call \f(CW\*(C`ev_loop_fork 1867To support fork in your child processes, you have to call \f(CW\*(C`ev_loop_fork
1804()\*(C'\fR after a fork in the child, enable \f(CW\*(C`EVFLAG_FORKCHECK\*(C'\fR, or resort to 1868()\*(C'\fR after a fork in the child, enable \f(CW\*(C`EVFLAG_FORKCHECK\*(C'\fR, or resort to
1805\&\f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR. 1869\&\f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR.
1806.PP 1870.PP
1811when writing to a pipe whose other end has been closed, your program gets 1875when writing to a pipe whose other end has been closed, your program gets
1812sent a \s-1SIGPIPE,\s0 which, by default, aborts your program. For most programs 1876sent a \s-1SIGPIPE,\s0 which, by default, aborts your program. For most programs
1813this is sensible behaviour, for daemons, this is usually undesirable. 1877this is sensible behaviour, for daemons, this is usually undesirable.
1814.PP 1878.PP
1815So when you encounter spurious, unexplained daemon exits, make sure you 1879So when you encounter spurious, unexplained daemon exits, make sure you
1816ignore \s-1SIGPIPE \s0(and maybe make sure you log the exit status of your daemon 1880ignore \s-1SIGPIPE\s0 (and maybe make sure you log the exit status of your daemon
1817somewhere, as that would have given you a big clue). 1881somewhere, as that would have given you a big clue).
1818.PP 1882.PP
1819\fIThe special problem of \fIaccept()\fIing when you can't\fR 1883\fIThe special problem of \f(BIaccept()\fIing when you can't\fR
1820.IX Subsection "The special problem of accept()ing when you can't" 1884.IX Subsection "The special problem of accept()ing when you can't"
1821.PP 1885.PP
1822Many implementations of the \s-1POSIX \s0\f(CW\*(C`accept\*(C'\fR function (for example, 1886Many implementations of the \s-1POSIX\s0 \f(CW\*(C`accept\*(C'\fR function (for example,
1823found in post\-2004 Linux) have the peculiar behaviour of not removing a 1887found in post\-2004 Linux) have the peculiar behaviour of not removing a
1824connection from the pending queue in all error cases. 1888connection from the pending queue in all error cases.
1825.PP 1889.PP
1826For example, larger servers often run out of file descriptors (because 1890For example, larger servers often run out of file descriptors (because
1827of resource limits), causing \f(CW\*(C`accept\*(C'\fR to fail with \f(CW\*(C`ENFILE\*(C'\fR but not 1891of resource limits), causing \f(CW\*(C`accept\*(C'\fR to fail with \f(CW\*(C`ENFILE\*(C'\fR but not
2251.IX Item "ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)" 2315.IX Item "ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat)"
2252.PD 0 2316.PD 0
2253.IP "ev_timer_set (ev_timer *, ev_tstamp after, ev_tstamp repeat)" 4 2317.IP "ev_timer_set (ev_timer *, ev_tstamp after, ev_tstamp repeat)" 4
2254.IX Item "ev_timer_set (ev_timer *, ev_tstamp after, ev_tstamp repeat)" 2318.IX Item "ev_timer_set (ev_timer *, ev_tstamp after, ev_tstamp repeat)"
2255.PD 2319.PD
2256Configure the timer to trigger after \f(CW\*(C`after\*(C'\fR seconds. If \f(CW\*(C`repeat\*(C'\fR 2320Configure the timer to trigger after \f(CW\*(C`after\*(C'\fR seconds (fractional and
2257is \f(CW0.\fR, then it will automatically be stopped once the timeout is 2321negative values are supported). If \f(CW\*(C`repeat\*(C'\fR is \f(CW0.\fR, then it will
2258reached. If it is positive, then the timer will automatically be 2322automatically be stopped once the timeout is reached. If it is positive,
2259configured to trigger again \f(CW\*(C`repeat\*(C'\fR seconds later, again, and again, 2323then the timer will automatically be configured to trigger again \f(CW\*(C`repeat\*(C'\fR
2260until stopped manually. 2324seconds later, again, and again, until stopped manually.
2261.Sp 2325.Sp
2262The timer itself will do a best-effort at avoiding drift, that is, if 2326The timer itself will do a best-effort at avoiding drift, that is, if
2263you configure a timer to trigger every 10 seconds, then it will normally 2327you configure a timer to trigger every 10 seconds, then it will normally
2264trigger at exactly 10 second intervals. If, however, your program cannot 2328trigger at exactly 10 second intervals. If, however, your program cannot
2265keep up with the timer (because it takes longer than those 10 seconds to 2329keep up with the timer (because it takes longer than those 10 seconds to
2362\&\f(CW\*(C`ev_timer\*(C'\fR, which would still trigger roughly 10 seconds after starting 2426\&\f(CW\*(C`ev_timer\*(C'\fR, which would still trigger roughly 10 seconds after starting
2363it, as it uses a relative timeout). 2427it, as it uses a relative timeout).
2364.PP 2428.PP
2365\&\f(CW\*(C`ev_periodic\*(C'\fR watchers can also be used to implement vastly more complex 2429\&\f(CW\*(C`ev_periodic\*(C'\fR watchers can also be used to implement vastly more complex
2366timers, such as triggering an event on each \*(L"midnight, local time\*(R", or 2430timers, such as triggering an event on each \*(L"midnight, local time\*(R", or
2367other complicated rules. This cannot be done with \f(CW\*(C`ev_timer\*(C'\fR watchers, as 2431other complicated rules. This cannot easily be done with \f(CW\*(C`ev_timer\*(C'\fR
2368those cannot react to time jumps. 2432watchers, as those cannot react to time jumps.
2369.PP 2433.PP
2370As with timers, the callback is guaranteed to be invoked only when the 2434As with timers, the callback is guaranteed to be invoked only when the
2371point in time where it is supposed to trigger has passed. If multiple 2435point in time where it is supposed to trigger has passed. If multiple
2372timers become ready during the same loop iteration then the ones with 2436timers become ready during the same loop iteration then the ones with
2373earlier time-out values are invoked before ones with later time-out values 2437earlier time-out values are invoked before ones with later time-out values
2434In this mode the values for \f(CW\*(C`interval\*(C'\fR and \f(CW\*(C`offset\*(C'\fR are both being 2498In this mode the values for \f(CW\*(C`interval\*(C'\fR and \f(CW\*(C`offset\*(C'\fR are both being
2435ignored. Instead, each time the periodic watcher gets scheduled, the 2499ignored. Instead, each time the periodic watcher gets scheduled, the
2436reschedule callback will be called with the watcher as first, and the 2500reschedule callback will be called with the watcher as first, and the
2437current time as second argument. 2501current time as second argument.
2438.Sp 2502.Sp
2439\&\s-1NOTE: \s0\fIThis callback \s-1MUST NOT\s0 stop or destroy any periodic watcher, ever, 2503\&\s-1NOTE:\s0 \fIThis callback \s-1MUST NOT\s0 stop or destroy any periodic watcher, ever,
2440or make \s-1ANY\s0 other event loop modifications whatsoever, unless explicitly 2504or make \s-1ANY\s0 other event loop modifications whatsoever, unless explicitly
2441allowed by documentation here\fR. 2505allowed by documentation here\fR.
2442.Sp 2506.Sp
2443If you need to stop it, return \f(CW\*(C`now + 1e30\*(C'\fR (or so, fudge fudge) and stop 2507If you need to stop it, return \f(CW\*(C`now + 1e30\*(C'\fR (or so, fudge fudge) and stop
2444it afterwards (e.g. by starting an \f(CW\*(C`ev_prepare\*(C'\fR watcher, which is the 2508it afterwards (e.g. by starting an \f(CW\*(C`ev_prepare\*(C'\fR watcher, which is the
2458It must return the next time to trigger, based on the passed time value 2522It must return the next time to trigger, based on the passed time value
2459(that is, the lowest time value larger than to the second argument). It 2523(that is, the lowest time value larger than to the second argument). It
2460will usually be called just before the callback will be triggered, but 2524will usually be called just before the callback will be triggered, but
2461might be called at other times, too. 2525might be called at other times, too.
2462.Sp 2526.Sp
2463\&\s-1NOTE: \s0\fIThis callback must always return a time that is higher than or 2527\&\s-1NOTE:\s0 \fIThis callback must always return a time that is higher than or
2464equal to the passed \f(CI\*(C`now\*(C'\fI value\fR. 2528equal to the passed \f(CI\*(C`now\*(C'\fI value\fR.
2465.Sp 2529.Sp
2466This can be used to create very complex timers, such as a timer that 2530This can be used to create very complex timers, such as a timer that
2467triggers on \*(L"next midnight, local time\*(R". To do this, you would calculate the 2531triggers on \*(L"next midnight, local time\*(R". To do this, you would calculate
2468next midnight after \f(CW\*(C`now\*(C'\fR and return the timestamp value for this. How 2532the next midnight after \f(CW\*(C`now\*(C'\fR and return the timestamp value for
2469you do this is, again, up to you (but it is not trivial, which is the main 2533this. Here is a (completely untested, no error checking) example on how to
2470reason I omitted it as an example). 2534do this:
2535.Sp
2536.Vb 1
2537\& #include <time.h>
2538\&
2539\& static ev_tstamp
2540\& my_rescheduler (ev_periodic *w, ev_tstamp now)
2541\& {
2542\& time_t tnow = (time_t)now;
2543\& struct tm tm;
2544\& localtime_r (&tnow, &tm);
2545\&
2546\& tm.tm_sec = tm.tm_min = tm.tm_hour = 0; // midnight current day
2547\& ++tm.tm_mday; // midnight next day
2548\&
2549\& return mktime (&tm);
2550\& }
2551.Ve
2552.Sp
2553Note: this code might run into trouble on days that have more then two
2554midnights (beginning and end).
2471.RE 2555.RE
2472.RS 4 2556.RS 4
2473.RE 2557.RE
2474.IP "ev_periodic_again (loop, ev_periodic *)" 4 2558.IP "ev_periodic_again (loop, ev_periodic *)" 4
2475.IX Item "ev_periodic_again (loop, ev_periodic *)" 2559.IX Item "ev_periodic_again (loop, ev_periodic *)"
2593The simplest way to ensure that the signal mask is reset in the child is 2677The simplest way to ensure that the signal mask is reset in the child is
2594to install a fork handler with \f(CW\*(C`pthread_atfork\*(C'\fR that resets it. That will 2678to install a fork handler with \f(CW\*(C`pthread_atfork\*(C'\fR that resets it. That will
2595catch fork calls done by libraries (such as the libc) as well. 2679catch fork calls done by libraries (such as the libc) as well.
2596.PP 2680.PP
2597In current versions of libev, the signal will not be blocked indefinitely 2681In current versions of libev, the signal will not be blocked indefinitely
2598unless you use the \f(CW\*(C`signalfd\*(C'\fR \s-1API \s0(\f(CW\*(C`EV_SIGNALFD\*(C'\fR). While this reduces 2682unless you use the \f(CW\*(C`signalfd\*(C'\fR \s-1API\s0 (\f(CW\*(C`EV_SIGNALFD\*(C'\fR). While this reduces
2599the window of opportunity for problems, it will not go away, as libev 2683the window of opportunity for problems, it will not go away, as libev
2600\&\fIhas\fR to modify the signal mask, at least temporarily. 2684\&\fIhas\fR to modify the signal mask, at least temporarily.
2601.PP 2685.PP
2602So I can't stress this enough: \fIIf you do not reset your signal mask when 2686So I can't stress this enough: \fIIf you do not reset your signal mask when
2603you expect it to be empty, you have a race condition in your code\fR. This 2687you expect it to be empty, you have a race condition in your code\fR. This
3645is a time window between the event loop checking and resetting the async 3729is a time window between the event loop checking and resetting the async
3646notification, and the callback being invoked. 3730notification, and the callback being invoked.
3647.SH "OTHER FUNCTIONS" 3731.SH "OTHER FUNCTIONS"
3648.IX Header "OTHER FUNCTIONS" 3732.IX Header "OTHER FUNCTIONS"
3649There are some other functions of possible interest. Described. Here. Now. 3733There are some other functions of possible interest. Described. Here. Now.
3650.IP "ev_once (loop, int fd, int events, ev_tstamp timeout, callback)" 4 3734.IP "ev_once (loop, int fd, int events, ev_tstamp timeout, callback, arg)" 4
3651.IX Item "ev_once (loop, int fd, int events, ev_tstamp timeout, callback)" 3735.IX Item "ev_once (loop, int fd, int events, ev_tstamp timeout, callback, arg)"
3652This function combines a simple timer and an I/O watcher, calls your 3736This function combines a simple timer and an I/O watcher, calls your
3653callback on whichever event happens first and automatically stops both 3737callback on whichever event happens first and automatically stops both
3654watchers. This is useful if you want to wait for a single event on an fd 3738watchers. This is useful if you want to wait for a single event on an fd
3655or timeout without having to allocate/configure/start/stop/free one or 3739or timeout without having to allocate/configure/start/stop/free one or
3656more watchers yourself. 3740more watchers yourself.
4106The normal C \s-1API\s0 should work fine when used from \*(C+: both ev.h and the 4190The normal C \s-1API\s0 should work fine when used from \*(C+: both ev.h and the
4107libev sources can be compiled as \*(C+. Therefore, code that uses the C \s-1API\s0 4191libev sources can be compiled as \*(C+. Therefore, code that uses the C \s-1API\s0
4108will work fine. 4192will work fine.
4109.PP 4193.PP
4110Proper exception specifications might have to be added to callbacks passed 4194Proper exception specifications might have to be added to callbacks passed
4111to libev: exceptions may be thrown only from watcher callbacks, all 4195to libev: exceptions may be thrown only from watcher callbacks, all other
4112other callbacks (allocator, syserr, loop acquire/release and periodic 4196callbacks (allocator, syserr, loop acquire/release and periodic reschedule
4113reschedule callbacks) must not throw exceptions, and might need a \f(CW\*(C`throw 4197callbacks) must not throw exceptions, and might need a \f(CW\*(C`noexcept\*(C'\fR
4114()\*(C'\fR specification. If you have code that needs to be compiled as both C 4198specification. If you have code that needs to be compiled as both C and
4115and \*(C+ you can use the \f(CW\*(C`EV_THROW\*(C'\fR macro for this: 4199\&\*(C+ you can use the \f(CW\*(C`EV_NOEXCEPT\*(C'\fR macro for this:
4116.PP 4200.PP
4117.Vb 6 4201.Vb 6
4118\& static void 4202\& static void
4119\& fatal_error (const char *msg) EV_THROW 4203\& fatal_error (const char *msg) EV_NOEXCEPT
4120\& { 4204\& {
4121\& perror (msg); 4205\& perror (msg);
4122\& abort (); 4206\& abort ();
4123\& } 4207\& }
4124\& 4208\&
4498\& #include "ev.c" 4582\& #include "ev.c"
4499.Ve 4583.Ve
4500.PP 4584.PP
4501This will automatically include \fIev.h\fR, too, and should be done in a 4585This will automatically include \fIev.h\fR, too, and should be done in a
4502single C source file only to provide the function implementations. To use 4586single C source file only to provide the function implementations. To use
4503it, do the same for \fIev.h\fR in all files wishing to use this \s-1API \s0(best 4587it, do the same for \fIev.h\fR in all files wishing to use this \s-1API\s0 (best
4504done by writing a wrapper around \fIev.h\fR that you can include instead and 4588done by writing a wrapper around \fIev.h\fR that you can include instead and
4505where you can put other configuration options): 4589where you can put other configuration options):
4506.PP 4590.PP
4507.Vb 2 4591.Vb 2
4508\& #define EV_STANDALONE 1 4592\& #define EV_STANDALONE 1
4525\& ev_win32.c required on win32 platforms only 4609\& ev_win32.c required on win32 platforms only
4526\& 4610\&
4527\& ev_select.c only when select backend is enabled 4611\& ev_select.c only when select backend is enabled
4528\& ev_poll.c only when poll backend is enabled 4612\& ev_poll.c only when poll backend is enabled
4529\& ev_epoll.c only when the epoll backend is enabled 4613\& ev_epoll.c only when the epoll backend is enabled
4614\& ev_linuxaio.c only when the linux aio backend is enabled
4530\& ev_kqueue.c only when the kqueue backend is enabled 4615\& ev_kqueue.c only when the kqueue backend is enabled
4531\& ev_port.c only when the solaris port backend is enabled 4616\& ev_port.c only when the solaris port backend is enabled
4532.Ve 4617.Ve
4533.PP 4618.PP
4534\&\fIev.c\fR includes the backend files directly when enabled, so you only need 4619\&\fIev.c\fR includes the backend files directly when enabled, so you only need
4581values when compiling libev vs. including \fIev.h\fR, so it is permissible 4666values when compiling libev vs. including \fIev.h\fR, so it is permissible
4582to redefine them before including \fIev.h\fR without breaking compatibility 4667to redefine them before including \fIev.h\fR without breaking compatibility
4583to a compiled library. All other symbols change the \s-1ABI,\s0 which means all 4668to a compiled library. All other symbols change the \s-1ABI,\s0 which means all
4584users of libev and the libev code itself must be compiled with compatible 4669users of libev and the libev code itself must be compiled with compatible
4585settings. 4670settings.
4586.IP "\s-1EV_COMPAT3 \s0(h)" 4 4671.IP "\s-1EV_COMPAT3\s0 (h)" 4
4587.IX Item "EV_COMPAT3 (h)" 4672.IX Item "EV_COMPAT3 (h)"
4588Backwards compatibility is a major concern for libev. This is why this 4673Backwards compatibility is a major concern for libev. This is why this
4589release of libev comes with wrappers for the functions and symbols that 4674release of libev comes with wrappers for the functions and symbols that
4590have been renamed between libev version 3 and 4. 4675have been renamed between libev version 3 and 4.
4591.Sp 4676.Sp
4596typedef in that case. 4681typedef in that case.
4597.Sp 4682.Sp
4598In some future version, the default for \f(CW\*(C`EV_COMPAT3\*(C'\fR will become \f(CW0\fR, 4683In some future version, the default for \f(CW\*(C`EV_COMPAT3\*(C'\fR will become \f(CW0\fR,
4599and in some even more future version the compatibility code will be 4684and in some even more future version the compatibility code will be
4600removed completely. 4685removed completely.
4601.IP "\s-1EV_STANDALONE \s0(h)" 4 4686.IP "\s-1EV_STANDALONE\s0 (h)" 4
4602.IX Item "EV_STANDALONE (h)" 4687.IX Item "EV_STANDALONE (h)"
4603Must always be \f(CW1\fR if you do not use autoconf configuration, which 4688Must always be \f(CW1\fR if you do not use autoconf configuration, which
4604keeps libev from including \fIconfig.h\fR, and it also defines dummy 4689keeps libev from including \fIconfig.h\fR, and it also defines dummy
4605implementations for some libevent functions (such as logging, which is not 4690implementations for some libevent functions (such as logging, which is not
4606supported). It will also not define any of the structs usually found in 4691supported). It will also not define any of the structs usually found in
4715If defined to be \f(CW1\fR, libev will compile in support for the Linux 4800If defined to be \f(CW1\fR, libev will compile in support for the Linux
4716\&\f(CW\*(C`epoll\*(C'\fR(7) backend. Its availability will be detected at runtime, 4801\&\f(CW\*(C`epoll\*(C'\fR(7) backend. Its availability will be detected at runtime,
4717otherwise another method will be used as fallback. This is the preferred 4802otherwise another method will be used as fallback. This is the preferred
4718backend for GNU/Linux systems. If undefined, it will be enabled if the 4803backend for GNU/Linux systems. If undefined, it will be enabled if the
4719headers indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled. 4804headers indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled.
4805.IP "\s-1EV_USE_LINUXAIO\s0" 4
4806.IX Item "EV_USE_LINUXAIO"
4807If defined to be \f(CW1\fR, libev will compile in support for the Linux
4808aio backend. Due to it's currenbt limitations it has to be requested
4809explicitly. If undefined, it will be enabled on linux, otherwise
4810disabled.
4720.IP "\s-1EV_USE_KQUEUE\s0" 4 4811.IP "\s-1EV_USE_KQUEUE\s0" 4
4721.IX Item "EV_USE_KQUEUE" 4812.IX Item "EV_USE_KQUEUE"
4722If defined to be \f(CW1\fR, libev will compile in support for the \s-1BSD\s0 style 4813If defined to be \f(CW1\fR, libev will compile in support for the \s-1BSD\s0 style
4723\&\f(CW\*(C`kqueue\*(C'\fR(2) backend. Its actual availability will be detected at runtime, 4814\&\f(CW\*(C`kqueue\*(C'\fR(2) backend. Its actual availability will be detected at runtime,
4724otherwise another method will be used as fallback. This is the preferred 4815otherwise another method will be used as fallback. This is the preferred
4764handler \*(L"locking\*(R" as well as for signal and thread safety in \f(CW\*(C`ev_async\*(C'\fR 4855handler \*(L"locking\*(R" as well as for signal and thread safety in \f(CW\*(C`ev_async\*(C'\fR
4765watchers. 4856watchers.
4766.Sp 4857.Sp
4767In the absence of this define, libev will use \f(CW\*(C`sig_atomic_t volatile\*(C'\fR 4858In the absence of this define, libev will use \f(CW\*(C`sig_atomic_t volatile\*(C'\fR
4768(from \fIsignal.h\fR), which is usually good enough on most platforms. 4859(from \fIsignal.h\fR), which is usually good enough on most platforms.
4769.IP "\s-1EV_H \s0(h)" 4 4860.IP "\s-1EV_H\s0 (h)" 4
4770.IX Item "EV_H (h)" 4861.IX Item "EV_H (h)"
4771The name of the \fIev.h\fR header file used to include it. The default if 4862The name of the \fIev.h\fR header file used to include it. The default if
4772undefined is \f(CW"ev.h"\fR in \fIevent.h\fR, \fIev.c\fR and \fIev++.h\fR. This can be 4863undefined is \f(CW"ev.h"\fR in \fIevent.h\fR, \fIev.c\fR and \fIev++.h\fR. This can be
4773used to virtually rename the \fIev.h\fR header file in case of conflicts. 4864used to virtually rename the \fIev.h\fR header file in case of conflicts.
4774.IP "\s-1EV_CONFIG_H \s0(h)" 4 4865.IP "\s-1EV_CONFIG_H\s0 (h)" 4
4775.IX Item "EV_CONFIG_H (h)" 4866.IX Item "EV_CONFIG_H (h)"
4776If \f(CW\*(C`EV_STANDALONE\*(C'\fR isn't \f(CW1\fR, this variable can be used to override 4867If \f(CW\*(C`EV_STANDALONE\*(C'\fR isn't \f(CW1\fR, this variable can be used to override
4777\&\fIev.c\fR's idea of where to find the \fIconfig.h\fR file, similarly to 4868\&\fIev.c\fR's idea of where to find the \fIconfig.h\fR file, similarly to
4778\&\f(CW\*(C`EV_H\*(C'\fR, above. 4869\&\f(CW\*(C`EV_H\*(C'\fR, above.
4779.IP "\s-1EV_EVENT_H \s0(h)" 4 4870.IP "\s-1EV_EVENT_H\s0 (h)" 4
4780.IX Item "EV_EVENT_H (h)" 4871.IX Item "EV_EVENT_H (h)"
4781Similarly to \f(CW\*(C`EV_H\*(C'\fR, this macro can be used to override \fIevent.c\fR's idea 4872Similarly to \f(CW\*(C`EV_H\*(C'\fR, this macro can be used to override \fIevent.c\fR's idea
4782of how the \fIevent.h\fR header can be found, the default is \f(CW"event.h"\fR. 4873of how the \fIevent.h\fR header can be found, the default is \f(CW"event.h"\fR.
4783.IP "\s-1EV_PROTOTYPES \s0(h)" 4 4874.IP "\s-1EV_PROTOTYPES\s0 (h)" 4
4784.IX Item "EV_PROTOTYPES (h)" 4875.IX Item "EV_PROTOTYPES (h)"
4785If defined to be \f(CW0\fR, then \fIev.h\fR will not define any function 4876If defined to be \f(CW0\fR, then \fIev.h\fR will not define any function
4786prototypes, but still define all the structs and other symbols. This is 4877prototypes, but still define all the structs and other symbols. This is
4787occasionally useful if you want to provide your own wrapper functions 4878occasionally useful if you want to provide your own wrapper functions
4788around libev functions. 4879around libev functions.
4997.Vb 3 5088.Vb 3
4998\& #define EV_COMMON \e 5089\& #define EV_COMMON \e
4999\& SV *self; /* contains this struct */ \e 5090\& SV *self; /* contains this struct */ \e
5000\& SV *cb_sv, *fh /* note no trailing ";" */ 5091\& SV *cb_sv, *fh /* note no trailing ";" */
5001.Ve 5092.Ve
5002.IP "\s-1EV_CB_DECLARE \s0(type)" 4 5093.IP "\s-1EV_CB_DECLARE\s0 (type)" 4
5003.IX Item "EV_CB_DECLARE (type)" 5094.IX Item "EV_CB_DECLARE (type)"
5004.PD 0 5095.PD 0
5005.IP "\s-1EV_CB_INVOKE \s0(watcher, revents)" 4 5096.IP "\s-1EV_CB_INVOKE\s0 (watcher, revents)" 4
5006.IX Item "EV_CB_INVOKE (watcher, revents)" 5097.IX Item "EV_CB_INVOKE (watcher, revents)"
5007.IP "ev_set_cb (ev, cb)" 4 5098.IP "ev_set_cb (ev, cb)" 4
5008.IX Item "ev_set_cb (ev, cb)" 5099.IX Item "ev_set_cb (ev, cb)"
5009.PD 5100.PD
5010Can be used to change the callback member declaration in each watcher, 5101Can be used to change the callback member declaration in each watcher,
5013their default definitions. One possible use for overriding these is to 5104their default definitions. One possible use for overriding these is to
5014avoid the \f(CW\*(C`struct ev_loop *\*(C'\fR as first argument in all cases, or to use 5105avoid the \f(CW\*(C`struct ev_loop *\*(C'\fR as first argument in all cases, or to use
5015method calls instead of plain function calls in \*(C+. 5106method calls instead of plain function calls in \*(C+.
5016.SS "\s-1EXPORTED API SYMBOLS\s0" 5107.SS "\s-1EXPORTED API SYMBOLS\s0"
5017.IX Subsection "EXPORTED API SYMBOLS" 5108.IX Subsection "EXPORTED API SYMBOLS"
5018If you need to re-export the \s-1API \s0(e.g. via a \s-1DLL\s0) and you need a list of 5109If you need to re-export the \s-1API\s0 (e.g. via a \s-1DLL\s0) and you need a list of
5019exported symbols, you can use the provided \fISymbol.*\fR files which list 5110exported symbols, you can use the provided \fISymbol.*\fR files which list
5020all public symbols, one per line: 5111all public symbols, one per line:
5021.PP 5112.PP
5022.Vb 2 5113.Vb 2
5023\& Symbols.ev for libev proper 5114\& Symbols.ev for libev proper
5255.PP 5346.PP
5256\fI\f(CI\*(C`select\*(C'\fI is buggy\fR 5347\fI\f(CI\*(C`select\*(C'\fI is buggy\fR
5257.IX Subsection "select is buggy" 5348.IX Subsection "select is buggy"
5258.PP 5349.PP
5259All that's left is \f(CW\*(C`select\*(C'\fR, and of course Apple found a way to fuck this 5350All that's left is \f(CW\*(C`select\*(C'\fR, and of course Apple found a way to fuck this
5260one up as well: On \s-1OS/X, \s0\f(CW\*(C`select\*(C'\fR actively limits the number of file 5351one up as well: On \s-1OS/X,\s0 \f(CW\*(C`select\*(C'\fR actively limits the number of file
5261descriptors you can pass in to 1024 \- your program suddenly crashes when 5352descriptors you can pass in to 1024 \- your program suddenly crashes when
5262you use more. 5353you use more.
5263.PP 5354.PP
5264There is an undocumented \*(L"workaround\*(R" for this \- defining 5355There is an undocumented \*(L"workaround\*(R" for this \- defining
5265\&\f(CW\*(C`_DARWIN_UNLIMITED_SELECT\*(C'\fR, which libev tries to use, so select \fIshould\fR 5356\&\f(CW\*(C`_DARWIN_UNLIMITED_SELECT\*(C'\fR, which libev tries to use, so select \fIshould\fR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines