I assume that dBus was chosen because the author has control over both the
writer and reader processes and intends to pass messages between them about
the state of the PNG file. In dBus both sides of the communication channel
need to register.

I have not written a line of code for dBus, but it seems to be pretty
actively developed. So, 2005 article maybe not the best up to date resource.

T

On Dec 2, 2017 3:59 PM, "Galen Seitz" <[email protected]> wrote:

> On 12/01/17 12:09, michael wrote:
> > Hello pluggers,
> >
> > I need to use DBus on a Raspberry Pi 3 running Raspbian Stretch to
> > synchronize the reading and writing of a PNG file.
> > One program writes the graphics file, the other program needs to read
> > it.  File locking is cumbersome, how do you make
> > sure that the the writer gets a lock before the reader does?  If only
> > the writer could talk to the reader before the
> > reader grabs the file.  The writer should indicate whether or not the
> > file is ready to be read or maybe the file is still
> > being written.  Maybe the camera is still snapping a picture.  In
> > theory, if the programs communicate with each other there
> > is no need for file system level locks.
> >
> > Problem, the 2005 Linux Journal article that shows a way to use DBus
> > does not compile.  The original dbus is apparently
> > too low level and evidently it is deprecated.  Ouch!
> >
> > I'm trying to write a C program to go between the writer and the reader
> > and communicate with both of them concerning the
> > file in question using UNIX sockets, but that seems like overkill and
> > far more involved than I had hoped it would be.
>
> With a bit more detail of what you are trying to accomplish, you might
> get more responses.  It would be useful to have a overview of what you
> are trying to do.
>
> How frequently does the writer create png files?
>
> Does the writer always write to the same file name?
>
> Does the writer close the png file when it is done writing?
>
> Is there any sort of back pressure mechanism built into the writer?
>
> Does the reader have any sort of responsibility for managing the png file?
>
> Do you have the source code to both the writer and the reader?  If so,
> are you in a position to modify and build each of them?
>
>
> As a wild guess, I'm going to suggest that the inotify mechanism *might*
> be useful for your task, but without knowing more details, it really is
> a guess.
>
> galen
> --
> Galen Seitz
> [email protected]
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to