A class for thread synchronization using semaphores. More...
#include <SSemaphore.h>
Public Member Functions | |
int | wait () |
Waits indefinitely for the semaphore to be notified. | |
int | wait (unsigned int msec) |
Waits for the semaphore to be notified within a specified time. | |
void | notify () |
Notifies the semaphore. | |
SSemaphore () | |
Default constructor. Initializes the semaphore. | |
virtual | ~SSemaphore () |
Destructor. Cleans up the semaphore resources. | |
A class for thread synchronization using semaphores.
This class provides methods to wait for and notify semaphores.
Definition at line 27 of file SSemaphore.h.
SSemaphore::SSemaphore | ( | ) |
Default constructor. Initializes the semaphore.
Definition at line 13 of file SSemaphore.cpp.
|
virtual |
Destructor. Cleans up the semaphore resources.
Definition at line 19 of file SSemaphore.cpp.
void SSemaphore::notify | ( | ) |
Notifies the semaphore.
This function increases the semaphore count, allowing one or more waiting threads to proceed.
Definition at line 55 of file SSemaphore.cpp.
int SSemaphore::wait | ( | ) |
Waits indefinitely for the semaphore to be notified.
Definition at line 25 of file SSemaphore.cpp.
int SSemaphore::wait | ( | unsigned int | msec | ) |
Waits for the semaphore to be notified within a specified time.
msec | The maximum time to wait in milliseconds. |
Definition at line 37 of file SSemaphore.cpp.