Sometimes you may wish to write a program which needs to co-operate with another program to perform its function. Suppose, for example, that two processes are to communicate via a FIFO file. One of these two processes will create the FIFO and then both of them will use it to communicate.
Obviously, the process which does not create the FIFO file needs to wait for the other process to create the file before it may proceed. One way to achieve this process synchronization is to use the pause() system call:
#include <unistd.h> int pause(void);
This system call does nothing except suspend the execution of the process from which it is called. If the process subsequently receives a signal for which it has a signal handler in place, then, when the handler has executed, the pause() call will return with an error value and errno set to EINTR. This return value and error condition can be ignored because this is the only way for pause() to return.
The upshot of this is that one process will execute a pause() call when it needs to wait for another process to perform some action. When the action has been performed the other process can send a prearranged signal to the paused process which will force pause() to return and allow execution of the signaled process to resume, knowing that the event for which it was waiting has now occurred.