|
![](/i/fill.gif) |
On 16/05/2016 01:47 PM, scott wrote:
> What's the best way for this root process to "broadcast" to other
> (non-root) processes when that pin goes high? It will only happen at
> maximum frequency of about every 2 seconds, but any delay between the
> pin going high and the other processes seeing it should be minimal.
So you're mostly worried about latency. (?)
> I did think about using a file, that was write permission only for root,
> but readable by everyone, that seems like a lot of overhead though (and
> what if root tries to write to it as someone else is reading it?). In
> Windows I might consider using a broadcast message with the PostMessage
> API function, is there something similar for Linux?
Writing to a file (or, more likely, a *named pipe*) seems like a
reasonable way to do this, especially considering the low frequency of
updates. Hell, at this speed, you could almost create / delete an entire
empty file as your flag signal!
You could instead try TCP (or UDP), but I'd expect that to have much
higher overhead. I don't know if Unix sockets are any quicker.
Alternatively, learn how dbus works? Or MPI. Or one of the other
existing messaging frameworks.
Personally, if it were me, I'd go with named pipe. But I guess that's
just because I've used it before and I know how it works...
Post a reply to this message
|
![](/i/fill.gif) |