ev_async delays thread when joining

Juan Pablo L jpablolorenzetti at gmail.com
Sun Jan 2 13:28:54 CET 2011


Hi, yes, my mistake, the futex call is when waiting for the thread to be
joined.

write(1, "stopping watcher\n", 17stopping watcher
)      = 17
write(1, "watcher stopped\n", 16watcher stopped
)       = 16
write(1, "joining the thread\n", 19joining the thread
)    = 19

futex(0xb78d6bd8, FUTEX_WAIT, 13394, NULL) = 0  <---- HERE

write(1, "thread joined\n", 14thread joined
)         = 14
write(1, "destroying loop\n", 16destroying loop
)       = 16



On 2 January 2011 00:28, Marc Lehmann <schmorp at schmorp.de> wrote:

> 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 ?
>
> yes.
>
> > 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
>      -=====/_/_//_/\_,_/ /_/\_\
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20110102/eb69342a/attachment.html>


More information about the libev mailing list