Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::Condition Class Reference

Wrapper for the pthread_cond mechanism. More...

#include <Condition.h>

Public Types

typedef ::pthread_cond_t * handle_type
 Handle type.
 

Public Member Functions

 Condition (const std::string &name="")
 Constructor.
 
 ~Condition ()
 Destructor.
 
bool wait (Mutex &mutex, const TimeSpec &timeout=TimeSpec())
 Waits for a signal with a timeout when a non-zero timeout is passed.
 
bool notifyOne ()
 Signals a single thread.
 
int notifyAll ()
 Signals all threads.
 
 operator handle_type ()
 Casting operator.
 
const Conditionoperator= (const Condition &)=delete
 Prevent copying.
 
int getWaiting () const
 Returns the amount of threads waiting.
 
const std::string & getName ()
 

Detailed Description

Wrapper for the pthread_cond mechanism.

The condition is a single or all thread notification mechanism.

Member Typedef Documentation

◆ handle_type

typedef ::pthread_cond_t* sf::Condition::handle_type

Handle type.

Constructor & Destructor Documentation

◆ Condition()

sf::Condition::Condition ( const std::string &  name = "")
explicit

Constructor.

◆ ~Condition()

sf::Condition::~Condition ( )

Destructor.

Member Function Documentation

◆ getName()

const std::string & sf::Condition::getName ( )

◆ getWaiting()

int sf::Condition::getWaiting ( ) const

Returns the amount of threads waiting.

◆ notifyAll()

int sf::Condition::notifyAll ( )

Signals all threads.

Returns
Amount of waiting threads.

◆ notifyOne()

bool sf::Condition::notifyOne ( )

Signals a single thread.

Returns
Returns true when a thread was signaled.

◆ operator handle_type()

sf::Condition::operator handle_type ( )
inline

Casting operator.

◆ operator=()

const Condition & sf::Condition::operator= ( const Condition )
delete

Prevent copying.

◆ wait()

bool sf::Condition::wait ( Mutex mutex,
const TimeSpec timeout = TimeSpec() 
)

Waits for a signal with a timeout when a non-zero timeout is passed.

Parameters
mutex
timeoutTimeout applicable when not-zero.
Returns
True when signaled and False when not.

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