On Fri, Sep 08, 2023 at 02:32:46PM -0400, Olivier Langlois 
<oliv...@trillion01.com> wrote:
> but beside that, I have a hard time figuring out what could cause a
> segv into that small function...

Almost always, this is caused by race condiitons between threads. For
example, starting or stopping watcheres from multiple threads without
locking the loop.

> As a side note, I think that the assert text should be:
> "libev: pipe_w not active, but pipe written"

We don't know if the pipe was written. What we do know is that the intent
was that the pipe was not written, so the officially, the pipe was not
written, but the watcher  is also not active.

> An exceptional occurence but theoritically possible is the following:
> 
> ev_async_send() is called by another thread while the loop thread is
> processing pending watchers and one of these watchers is calling
> ev_async_stop() on the pending async watcher...

While its probably a (semantic) bug to do so, it is harmless to call
ev_async_send on a stopped watcher (other than losing the event, or
getting a spurious event later). Stopping and freeing the watcher would be
a different story, of course.

> I am currently studying libev code to convince myself that libev code
> handle correctly this case...

The more eyes, the better.

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

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

Reply via email to