in reply to Named pipes missing connections
Pipes don't serialize or check for things like two readers and writers. You can have a reader "A" open the pipe with writer "A", and then switch writers on the reader (by starting another writer "B" and THEN closing writer "A"). The reader sees an EOF only if a read attempt is made when no one is WRITING to it. This is further complicated by the fact that two different processes (Reader and writer) are not synched in other ways.
I recommend:
- a lock file to make sure two writers don't touch the pipe at the same time. Make this lock on a separate lock file (no use locking a pipe you just opened if the idea is to not touch the pipe before locking).
- Serialize the communications (have each writer use a unique number). How do you get the unique number? Using the lock file from (1) could be a solution.
I must admit I did not experiment with your code so there might be other reasons (but locking is a good idea if you have the remotest chance that two writers will need to talk at the same time).
-- termix
|
---|
In Section
Seekers of Perl Wisdom