On Sat, Feb 04, 2023 at 04:55:48PM +0530, Sudheer Hebbale 
<sudheerhebb...@gmail.com> wrote:
> The loop itself is started in a thread, and the main thread waits from
> interrupt (ctrl-c) to terminate the program.

It's not clear to me what you eman with "waits from interrupt", but in
general, when you use multiple threads, you cannot simply access the same
data structures without locking, which in this case, you do - you either have
to access the libev loop in only one thread, and send it some signal (with
an ev_async_send), or use some kind of mutex to coordinate access, or use
multiple independent loops.

That might or might not be the cause of your issue, but needs to be fixe
din any case, and could make the problem go away.

Also, threads (especially in a language such as C++) are rather difficult
to use correctly, so when in doubt, I would try to avoid them and use
event-based methods (which popen lends itself to naturally, start an io
watcher on the file descriptor and use unbuffered I/O).

> This does not happen if I do dlopen of another library (a dummy one).

It is possibly that the librarey you load change the process
environment. It might also not be prepared to be laoded into anything but
the main thread (for example, calling sigprocmask in a threaded program
is unspecified behaviour according to POSIX and might or might not do the
right thing on os x, even though this is unlikely to be the issue here).

-- 
                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
  • Need support Sudheer Hebbale
    • Re: Need support Marc Lehmann

Reply via email to