Event notice between processes, not threads?

Marc Lehmann schmorp at schmorp.de
Sat Jun 2 15:33:16 CEST 2018


On Tue, May 29, 2018 at 09:07:26AM -0700, Daniel Austin <daniel.r.austin at gmail.com> wrote:
> Hi, Marc.  Thank you for responding.  I did a little investigation on your
> comment about fds being useless to other processes and did not know they
> were process-unique.  Thanks for stopping me early. Your suggestion of a
> pipe looks like it will be the fastest (to implement) approach.  Would I
> simply have each watcher process ev_io watch the fifo for readable event,

A pipe is not a (linux-) fifo, but you can use an ev_io watcher in every
process on fifo or pipe fd's alike.

> the writer process puts a byte into the fifo, all the watcher processes get
> the readable event and wake up and non-block read to empty the pipe (one
> succeeds), do their respective tasks, and then repeat?  Thanks very much.

That's one way to do it - make sure you handle the case where the pipe is
full gracefully, though (e.g. by not blocking your writer, or ensuring
that this a non-issue).

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