Using ev_async for communication in the same event loop

Marc Lehmann schmorp at schmorp.de
Thu Apr 22 15:52:45 CEST 2021


On Sun, Apr 18, 2021 at 01:09:03PM -0700, Arun Athrey Chandrasekaran <achandr8 at ncsu.edu> wrote:
> in an asynchronous way and not miss other events in the main event loop. Is
> this expected to work? I looked at the documentation and it is not clear to
> me if ev_async can be used for communication in the same event loop.

Hi, there are no restrictions as to form which thread you ev_async_send,
which means you can do that from within the same event loop.

If you don't know whether it is the same thread or not, just use
ev_async_send. If you do know that it is within the same thread that owns
the event loop, it is more efficient to start an idle watcher.

-- 
                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