Proud::Semaphore Class Reference

Public Member Functions

PROUD_API Semaphore (int initialCount, int maxCount)
 
PROUD_API ~Semaphore ()
 
bool WaitOne ()
 
PROUD_API bool WaitOne (uint32_t timeOut)
 
PROUD_API void Release (int releaseCount=1)
 

Detailed Description

Semaphore object of multi-thread programming.

  • This works same as System.Threading.Semaphore of .Net Framework.

Constructor & Destructor Documentation

PROUD_API Proud::Semaphore::Semaphore ( int  initialCount,
int  maxCount 
)

Creator

Parameters
initialCountthe initial value that semaphore object will have.
maxCountthe maximum value that semaphore object can have.
PROUD_API Proud::Semaphore::~Semaphore ( )

Destructor

Member Function Documentation

PROUD_API void Proud::Semaphore::Release ( int  releaseCount = 1)

TODO:translate needed. Increase the internal count with a certain value.

Parameters
releaseCountValue to be increased
Returns
Internal value of semaphore before the increase.
bool Proud::Semaphore::WaitOne ( )
inline

It waits endlessly untill the internal counte becomes higher than 1. If the count becomes higher than 1, it reduces the count by 1 and returns.

PROUD_API bool Proud::Semaphore::WaitOne ( uint32_t  timeOut)

It waits for a specific time until the internal count becomes higher than 1. If the count becomes higher than 1, it reduces the count by 1 and returns.

Parameters
timeOut(millisecond) The maximum waiting time for signal standby. Input INFINITE if you want it to wait endlessly.