soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SSemaphore Class Reference

A class for thread synchronization using semaphores. More...

#include <SSemaphore.h>

Inheritance diagram for SSemaphore:
SNoCopyable

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.
 

Detailed Description

A class for thread synchronization using semaphores.

This class provides methods to wait for and notify semaphores.

Note
This class is non-copyable.

Definition at line 27 of file SSemaphore.h.

Constructor & Destructor Documentation

◆ SSemaphore()

SSemaphore::SSemaphore ( )

Default constructor. Initializes the semaphore.

Definition at line 13 of file SSemaphore.cpp.

◆ ~SSemaphore()

SSemaphore::~SSemaphore ( )
virtual

Destructor. Cleans up the semaphore resources.

Definition at line 19 of file SSemaphore.cpp.

Member Function Documentation

◆ notify()

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.

◆ wait() [1/2]

int SSemaphore::wait ( )

Waits indefinitely for the semaphore to be notified.

Returns
RETURN_OK if the semaphore is notified successfully.
RETURN_ERROR if an error occurs.

Definition at line 25 of file SSemaphore.cpp.

◆ wait() [2/2]

int SSemaphore::wait ( unsigned int msec)

Waits for the semaphore to be notified within a specified time.

Parameters
msecThe maximum time to wait in milliseconds.
Returns
RETURN_OK if the semaphore is notified successfully.
RETURN_TIMEOUT if the wait times out.
RETURN_ERROR if an error occurs.

Definition at line 37 of file SSemaphore.cpp.


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