On 27 January 2016 at 10:15, Ilya Kulakov <kulakov.i...@gmail.com> wrote:
> Hi, > > I found the following 2 chunks of code suspecting: > > - https://github.com/zeromq/libzmq/blob/master/src/select.cpp#L110-L113 > - https://github.com/zeromq/libzmq/blob/master/src/select.cpp#L170-L173 > > Why do we need to clear descriptos, if readfds/writefds/exceptfds are > initialized with contents of source_set_* at each iteration of the loop? > It may lead to an error if set is modified _while_ there is an active > select in another thread (I don't know if an instance of select_t can be > used from multiple threads). > Other than that this code looks pointless. > > What do you think? > Standard fair is that one event can cause the API to remove the socket from the set before one iteration of the loop has finished. https://github.com/zeromq/libzmq/blob/master/src/select.cpp#L203-L212 Of note there is actually a double check with L209-210. If you can guarantee the file descriptor is moved to retired_fd then you can remove the removal from the descriptor set. -- Steve-o
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev