9 #ifndef mrpt_synch_semaphore_H
10 #define mrpt_synch_semaphore_H
45 unsigned int initialCount,
46 unsigned int maxCount,
47 const std::string &name=std::string(
"") );
61 void release(
unsigned int increaseCount = 1);
65 inline std::string
getName()
const {
return m_name; }
68 inline bool isNamed()
const {
return !m_name.empty(); }
A semaphore for inter-thread synchronization.
virtual ~CSemaphore()
Destructor.
bool isNamed() const
Return true if this is a named semaphore.
std::string getName() const
Get the name of the named semaphore or an empty string if it's unnamed.
mrpt::utils::CReferencedMemBlock m_data
std::string m_name
The name of the named semaphore, or empty if unnamed.
CSemaphore(unsigned int initialCount, unsigned int maxCount, const std::string &name=std::string(""))
Creates a semaphore.
bool waitForSignal(unsigned int timeout_ms=0)
Blocks until the count of the semaphore to be non-zero.
void release(unsigned int increaseCount=1)
Increments the count of the semaphore by a given amount.
Represents a memory block (via "void*") that can be shared between several objects through copy opera...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.