c++-gtk-utils

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Cgu::SyncPipe Class Reference

A class which uses an anonymous pipe to synchronise between processes. More...

`#include <c++-gtk-utils/pipes.h>`

## Public Member Functions
void | release ()
void | wait ()
| SyncPipe ()
| ~SyncPipe ()

## Detailed Description

A class which uses an anonymous pipe to synchronise between processes.

See Also
  PipeFifo

This class enables synchronisation between processes after fork()ing. The process to wait on the other one calls wait() at the point where it wishes to wait, and the other process calls release() when it wants to enable the other process to continue. It is one-shot only - once it has released, it cannot re-block again. It is typically for use when a child process is setting itself up, or has a specific task to achieve, and needs to co-ordinate with the parent process or tell the parent process when it has done this. In such a case, the parent would wait until the child releases it.

## Constructor & Destructor Documentation

Cgu::SyncPipe::SyncPipe | ( | ) |  |
| inline

All the system calls made in the constructor are async-signal-safe.

Exceptions

  Cgu::PipeError | This exception is thrown if the opening of the pipe fails. No other exceptions will be thrown.

Cgu::SyncPipe::~SyncPipe | ( | ) |  |
| inline

The destructor does not throw. It is async-signal-safe.

## Member Function Documentation

void Cgu::SyncPipe::release | ( | ) |  |
| inline

Releases another process waiting on this pipe. If the other process has not yet called wait(), when it does so wait() will immediately return. This may safely be called after a multi-threaded process forks() (all the system calls made in its implementation are async-signal-safe), but only one thread should call it. It does not throw.

void Cgu::SyncPipe::wait | ( | ) |  |

Blocks until another process has called release() on this pipe. If the other process has already called release(), this function will immediately return. This may safely be called after a multi-threaded process forks() (all the system calls made in its implementation are async-signal-safe), but only one thread should call it. It does not throw.

The documentation for this class was generated from the following file:

- pipes.h