ev_async delays thread when joining

Marc Lehmann schmorp at schmorp.de
Sun Jan 2 05:28:18 CET 2011

On Sat, Jan 01, 2011 at 11:09:36PM -0400, Juan Pablo L <jpablolorenzetti at gmail.com> wrote:
> thank you very much for your feedback, the futex call is a call inside the
> epoll

I would claim that there is no such thing as a futex call inside epoll (or
epoll_ctl/epoll_wait), simply because it instantly calls into the kernel.

what evidence do you have that epoll is doing futex operations?

> anyways, in other words, you are saying that, for example, if i create
> a loop in thread 1 and i want to break it and destroy it or even stop
> the ev_async in thread 2 is not allowed ?


> i need to do a explicit loop locking in thread 2 ?

you need to make sure, in whatever way you wish, that only one call
is made for the same loop at the same time. it doesn't matter how you
achieve that. the only exceptions are ev_run (in the time between the loop
release/acquire callbacks) and ev_async_send.

for details, you can check the documentation.

> so from thread 2 i can only call ev_async_send and the rest of calls
> regarding the loop must be made inside thread 1 without locking (if i dont
> want to lock the loop) ?? thanks!

yes, exactly.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list