Event notice between processes, not threads?
daniel.r.austin at gmail.com
Mon May 28 07:03:32 CEST 2018
Hi. What is the proper mechanism to trigger an event in a separate
process, not a separate thread, assuming a modern Linux kernel?
1) Use ev_io on an eventfd file descriptor. Use normal eventfd file
operations to get the event to fire for all processes watching that fd for
read. This seems pretty easy because the watching processes don't need to
"register" with the triggering process, but they do need to get access to
the file description number somehow (e.g. shared memory or other means).
2) Use ev_async. I think the proper usage here would be to put the
ev_async watchers for each interested process in shared memory, and then
have the triggering process iterate through them all and call ev_async_send
on each one (using the triggering process's [default] event loop).
3) Something else?
If multiple methods are feasible, what are the pros and cons of each?
My use case is that one process generates data that gets put into shared
memory at a regular rate, and some number of observer processes need to be
notified each time that the shared memory space was updated so that they
can each examine the most recent data.
Thanks very much for considering my questions. I would appreciate any
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libev