Assuming I have the epoll instance mEPoll
, can I safely add (via EPOLL_CTL_ADD
) or remove (via EPOLL_CTL_DEL
) a socket handle via
struct epoll_event event;
event.data.fd = newFD;
event.events = eventmask;
epoll_ctl(mEPoll, EPOLL_CTL_ADD, newFD, &event);
...simultaneously from multiple threads, or do I need to add my own synchronisation primitive around epoll_ctl
?
EDIT:
It has been suggested that this question answers my question here. However, that question seems to focus on whether it is safe to call epoll_ctl
whilst waiting on epoll_wait
: I already know that is safe. This question is purely asking about whether I can simultaneously make two calls to epoll_ctl
and not run into problems.