process-cpp  3.0.0
A simple convenience library for handling processes in C++11.
core::testing::CrossProcessSync Class Reference

A cross-process synchronization primitive that supports simple wait-condition-like scenarios. More...

#include <cross_process_sync.h>

+ Collaboration diagram for core::testing::CrossProcessSync:

Classes

struct  Error
 

Public Member Functions

 CrossProcessSync ()
 Constructs a new sync element. More...
 
 CrossProcessSync (const CrossProcessSync &rhs)
 Copy c'tor, duping the underlying fds. More...
 
 ~CrossProcessSync () noexcept
 Closes the underlying fds. More...
 
CrossProcessSyncoperator= (const CrossProcessSync &rhs)
 operator =, dup's the underlying fds. More...
 
void try_signal_ready_for (const std::chrono::milliseconds &duration)
 Try to signal the other side that we are ready for at most duration milliseconds. More...
 
std::uint32_t wait_for_signal_ready_for (const std::chrono::milliseconds &duration)
 Wait for the other sides to signal readiness for at most duration milliseconds. More...
 

Detailed Description

A cross-process synchronization primitive that supports simple wait-condition-like scenarios.

Definition at line 36 of file cross_process_sync.h.

Constructor & Destructor Documentation

core::testing::CrossProcessSync::CrossProcessSync ( )

Constructs a new sync element.

Definition at line 32 of file cross_process_sync.cpp.

core::testing::CrossProcessSync::CrossProcessSync ( const CrossProcessSync rhs)

Copy c'tor, duping the underlying fds.

Parameters
rhsThe instance to copy.

Definition at line 38 of file cross_process_sync.cpp.

core::testing::CrossProcessSync::~CrossProcessSync ( )
noexcept

Closes the underlying fds.

Definition at line 44 of file cross_process_sync.cpp.

Member Function Documentation

core::testing::CrossProcessSync & core::testing::CrossProcessSync::operator= ( const CrossProcessSync rhs)

operator =, dup's the underlying fds.

Parameters
rhsThe instance to assign from.
Returns
A mutable reference to this instance.

Definition at line 50 of file cross_process_sync.cpp.

void core::testing::CrossProcessSync::try_signal_ready_for ( const std::chrono::milliseconds &  duration)

Try to signal the other side that we are ready for at most duration milliseconds.

Exceptions
Error::Timeoutin case of a timeout.
std::system_errorfor problems with the underlying pipe.

Definition at line 62 of file cross_process_sync.cpp.

Referenced by TEST().

std::uint32_t core::testing::CrossProcessSync::wait_for_signal_ready_for ( const std::chrono::milliseconds &  duration)

Wait for the other sides to signal readiness for at most duration milliseconds.

Returns
The number of ready signals that have been collected since creation.
Exceptions
Error::Timeoutin case of a timeout.
std::system_errorfor problems with the underlying pipe.

Definition at line 78 of file cross_process_sync.cpp.

Referenced by TEST().


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