I need to implement a handshake type protocol in to a small Linux program that uses named pipes to communicate with other processes. I've searched for a general implementation pattern for a handshake type protocol when using named pipes but I've not been able to turn anything up...
I simply can't believe that there isn't patterns to do this. Can someone point me to a possible resource?
In full disclosure this is for homework but implementing this pattern isn't the homework. We need to solve a problem within the homework code and I believe this to be a possible solution. The homework is implemented in C++ -- but the languages doesn't matter to me. I just don't want to reinvent the wheel....
Update: I have a feeling that this might be implemented with signals.
What I mean by handshake is that a child process reports to it's parent process that it is ready for work but does not proceed (even if there is something in the pipe) until the parent gives the go signal. In my working theory, I will have many child processes that need to report ready and wait for the go signal from the parent.
What is the opposite of Wine? [closed]
Convert a Static Library to a Shared Library?
How can I serve an ASP.NET application on a Linux Server?
The writer process opens the pipe for writing, the reader process opens the pipe for reading, and whichever happens first blocks until the other process opens its side.
Determine UID that last modified a file in Linux?
This can be extended to use nonblocking IO on the reader side..
Estimating relative CPU usage during compilation
Named pipes are most useful for one-to-one IPC.
Access to errno from Python?
In your one-to-many situation, you should probably use a UNIX-domain socket instead..
socket behaviour when in blocking mode
How do I ensure only one instance of a Ruby script is running at a time?