OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::PThreadBarrier Class Reference

#include <pthreadcond.hpp>

Collaboration diagram for openvpn::PThreadBarrier:
[legend]

Public Types

enum  Status { SUCCESS = 0 , CHOSEN_ONE , TIMEOUT , ERROR_SIGNAL }
 

Public Member Functions

 PThreadBarrier (const int initial_limit=-1)
 
 PThreadBarrier (Stop *stop_arg, const int initial_limit=-1)
 
int wait (const unsigned int seconds)
 
void set_limit (const int new_limit)
 
void signal ()
 
void error ()
 

Private Types

enum  State { UNSIGNALED = 0 , SIGNALED , ERROR_THROWN }
 

Private Member Functions

void signal_ (const State newstate)
 

Private Attributes

std::mutex mutex
 
std::condition_variable cv
 
Stopstop
 
State state {UNSIGNALED}
 
bool chosen = false
 
int count = 0
 
int limit
 

Detailed Description

Definition at line 27 of file pthreadcond.hpp.

Member Enumeration Documentation

◆ State

Enumerator
UNSIGNALED 
SIGNALED 
ERROR_THROWN 

Definition at line 29 of file pthreadcond.hpp.

◆ Status

Enumerator
SUCCESS 
CHOSEN_ONE 
TIMEOUT 
ERROR_SIGNAL 

Definition at line 38 of file pthreadcond.hpp.

Constructor & Destructor Documentation

◆ PThreadBarrier() [1/2]

openvpn::PThreadBarrier::PThreadBarrier ( const int  initial_limit = -1)
inline

Definition at line 46 of file pthreadcond.hpp.

◆ PThreadBarrier() [2/2]

openvpn::PThreadBarrier::PThreadBarrier ( Stop stop_arg,
const int  initial_limit = -1 
)
inline

Definition at line 52 of file pthreadcond.hpp.

Member Function Documentation

◆ error()

void openvpn::PThreadBarrier::error ( )
inline

Definition at line 107 of file pthreadcond.hpp.

Here is the caller graph for this function:

◆ set_limit()

void openvpn::PThreadBarrier::set_limit ( const int  new_limit)
inline

Definition at line 91 of file pthreadcond.hpp.

◆ signal()

void openvpn::PThreadBarrier::signal ( )
inline

Definition at line 100 of file pthreadcond.hpp.

◆ signal_()

void openvpn::PThreadBarrier::signal_ ( const State  newstate)
inlineprivate

Definition at line 113 of file pthreadcond.hpp.

Here is the caller graph for this function:

◆ wait()

int openvpn::PThreadBarrier::wait ( const unsigned int  seconds)
inline

Definition at line 63 of file pthreadcond.hpp.

Member Data Documentation

◆ chosen

bool openvpn::PThreadBarrier::chosen = false
private

Definition at line 127 of file pthreadcond.hpp.

◆ count

int openvpn::PThreadBarrier::count = 0
private

Definition at line 128 of file pthreadcond.hpp.

◆ cv

std::condition_variable openvpn::PThreadBarrier::cv
private

Definition at line 124 of file pthreadcond.hpp.

◆ limit

int openvpn::PThreadBarrier::limit
private

Definition at line 129 of file pthreadcond.hpp.

◆ mutex

std::mutex openvpn::PThreadBarrier::mutex
private

Definition at line 123 of file pthreadcond.hpp.

◆ state

State openvpn::PThreadBarrier::state {UNSIGNALED}
private

Definition at line 126 of file pthreadcond.hpp.

◆ stop

Stop* openvpn::PThreadBarrier::stop
private

Definition at line 125 of file pthreadcond.hpp.


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