You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libevent can add events on sockets or events for timeouts w/o any socket attached. Events with sockets work as select can handle that. But when timeout events are added they get added with a fd of -1. and as the select_init of libevent always creates a fd_set we end up calling select with an fd_set but 0 ndfs. This gives a EINTR, which is not right. It just should wait the time in timeout.
The text was updated successfully, but these errors were encountered:
Looks like LIBC select simply doesn't expect this situation. POSIX is silent about this particular case. However, Linux is pretty verbose:
Some code calls select() with all three sets empty, nfds zero, and a
non-NULL timeout as a fairly portable way to sleep with subsecond
precision.
Which means that a zero ndfs value and empty sets should trigger a wait cycle (if specified). And that's what all other platforms do. I will fix LIBC to do the same.
Note that the above fix will always cause a wait cycle if nfds is 0, i.e. it's not strictly necessary for FD sets to be empty. But given that this is non-POSIX (non-standard) behavior anyway, I think it's OK for the sake of code simplicity. If we find any compatibility issue, we will reconsider this.
Please check and feel free to reopen if it doesn't fix libevent tests for you. The test build of LIBC is available in /test.
libevent can add events on sockets or events for timeouts w/o any socket attached. Events with sockets work as select can handle that. But when timeout events are added they get added with a fd of -1. and as the select_init of libevent always creates a fd_set we end up calling select with an fd_set but 0 ndfs. This gives a EINTR, which is not right. It just should wait the time in timeout.
The text was updated successfully, but these errors were encountered: