Main MRPT website > C++ reference for MRPT 1.5.6
List of all members | Public Member Functions | Protected Attributes
mrpt::synch::CSemaphore Class Reference

Detailed Description

A semaphore for inter-thread synchronization.

The state of a semaphore object is signaled when its count is greater than zero, and nonsignaled when its count is equal to zero. The initialCount parameter specifies the initial count. Each time a waiting thread is released because of the semaphore's signaled state, the count of the semaphore is decreased by one. Use the release function to increment a semaphore's count by a specified amount. The count can never be less than zero or greater than the value specified in the maxCount parameter.

Definition at line 28 of file CSemaphore.h.

#include <mrpt/synch/CSemaphore.h>

Public Member Functions

 CSemaphore (unsigned int initialCount, unsigned int maxCount)
 Creates a semaphore. More...
 
virtual ~CSemaphore ()
 Dtor. More...
 
bool waitForSignal (unsigned int timeout_ms=0)
 Blocks until the count of the semaphore to be non-zero. More...
 
void release (unsigned int increaseCount=1)
 Increments the count of the semaphore by a given amount. More...
 

Protected Attributes

mrpt::utils::CReferencedMemBlock m_data
 

Constructor & Destructor Documentation

mrpt::synch::CSemaphore::CSemaphore ( unsigned int  initialCount,
unsigned int  maxCount 
)

Creates a semaphore.

virtual mrpt::synch::CSemaphore::~CSemaphore ( )
virtual

Dtor.

Member Function Documentation

void mrpt::synch::CSemaphore::release ( unsigned int  increaseCount = 1)
bool mrpt::synch::CSemaphore::waitForSignal ( unsigned int  timeout_ms = 0)

Member Data Documentation

mrpt::utils::CReferencedMemBlock mrpt::synch::CSemaphore::m_data
protected

Definition at line 31 of file CSemaphore.h.




Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018