sipxportlib  Version 3.3
Public Types | Public Member Functions | Protected Member Functions | List of all members
OsCSemBase Class Referenceabstract

Counting semaphore. More...

#include <OsCSem.h>

Inheritance diagram for OsCSemBase:
Inheritance graph
[legend]
Collaboration diagram for OsCSemBase:
Collaboration graph
[legend]

Public Types

enum  QueueOptions { Q_FIFO = 0x0, Q_PRIORITY = 0x1 }
 

Public Member Functions

virtual OsStatus acquire (const OsTime &rTimeout=OsTime::OS_INFINITY)=0
 Block the task until the semaphore is acquired or the timeout expires. More...
 
virtual OsStatus tryAcquire (void)=0
 Conditionally acquire the semaphore (i.e., don't block) More...
 
virtual OsStatus release (void)=0
 Release the semaphore. More...
 
- Public Member Functions inherited from OsSyncBase
virtual ~OsSyncBase ()
 Destructor. More...
 
OsSyncBaseoperator= (const OsSyncBase &rhs)
 Assignment operator. More...
 

Protected Member Functions

 OsCSemBase (const int queueOptions, const int maxCount, const int initCount)
 Default constructor. More...
 
virtual ~OsCSemBase ()
 Destructor. More...
 
- Protected Member Functions inherited from OsSyncBase
 OsSyncBase ()
 Default constructor. More...
 

Detailed Description

Counting semaphore.

Member Enumeration Documentation

Enumerator
Q_FIFO 

queue blocked tasks on a first-in, first-out basis

Q_PRIORITY 

queue blocked tasks based on their priority

Constructor & Destructor Documentation

OsCSemBase ( const int  queueOptions,
const int  maxCount,
const int  initCount 
)
protected

Default constructor.

virtual ~OsCSemBase ( )
inlineprotectedvirtual

Destructor.

Member Function Documentation

virtual OsStatus acquire ( const OsTime rTimeout = OsTime::OS_INFINITY)
pure virtual

Block the task until the semaphore is acquired or the timeout expires.

Implements OsSyncBase.

Implemented in OsCSemWnt, and OsCSemLinux.

virtual OsStatus tryAcquire ( void  )
pure virtual

Conditionally acquire the semaphore (i.e., don't block)

Implements OsSyncBase.

Implemented in OsCSemWnt, and OsCSemLinux.

virtual OsStatus release ( void  )
pure virtual

Release the semaphore.

Returns
OS_BUSY if the semaphore is held by some other task.

Implements OsSyncBase.

Implemented in OsCSemWnt, and OsCSemLinux.