On 10/23/07, Dave Van den Eynde <[EMAIL PROTECTED]> wrote:
> It's just a matter of deciding whether all of the information
> from one process needs to be read in the other process
> or that it's the 'last known state' of a certain information that
> needs to be available at all times but rarely read.

I agree. I had a similar problem in the past and I used a file based solution.

My situation was the following:
_ (1) a C program working in background
_ (2) a C program that sometimes needs the last available status of (1).
_ the status was a small set of numbers

This is the solution I used:
_ (1) writes every N seconds a file (e.g. /tmp/status.txt) containing
its status, overwriting any data already present in the file
_ when (2) needs (1)'s status, it reads it from file
_ in order to manage concurrent access I used a locking/unlocking
mechanism based on System V IPC semaphores:
http://www.linuxhq.com/guides/LPG/node7.html

I have the feeling this is not the best solution, but I was not able
to find an easier and cleaner alternative.

What do you think?

bye, michele

Reply via email to