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

Binary semaphore. More...

#include <OsBSem.h>

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

Public Types

enum  InitialSemaphoreState { EMPTY = 0, FULL = 1 }
 
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...
 
virtual void OsBSemShow (void)=0
 Print semaphore information to the console. More...
 
- Public Member Functions inherited from OsSyncBase
virtual ~OsSyncBase ()
 Destructor. More...
 
OsSyncBaseoperator= (const OsSyncBase &rhs)
 Assignment operator. More...
 

Protected Member Functions

 OsBSemBase ()
 Default constructor. More...
 
virtual ~OsBSemBase ()
 Destructor. More...
 
- Protected Member Functions inherited from OsSyncBase
 OsSyncBase ()
 Default constructor. More...
 

Protected Attributes

int mOptions
 options specified at time of binary semaphore creation More...
 
int mTaskId
 if OS_SYNC_DEBUG is enabled, ONLY ON WNT, we use this < variable to store the ID of the task currently holding the semaphore More...
 

Detailed Description

Binary semaphore.

Member Enumeration Documentation

Enumerator
EMPTY 

semaphore is initially unavailable

FULL 

semaphore is initially available

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

OsBSemBase ( )
inlineprotected

Default constructor.

virtual ~OsBSemBase ( )
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 OsBSemWnt, and OsBSemLinux.

virtual OsStatus tryAcquire ( void  )
pure virtual

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

Implements OsSyncBase.

Implemented in OsBSemWnt, and OsBSemLinux.

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 OsBSemWnt, and OsBSemLinux.

virtual void OsBSemShow ( void  )
pure virtual

Print semaphore information to the console.

Implemented in OsBSemWnt, and OsBSemLinux.

Member Data Documentation

int mOptions
protected

options specified at time of binary semaphore creation

int mTaskId
protected

if OS_SYNC_DEBUG is enabled, ONLY ON WNT, we use this < variable to store the ID of the task currently holding the semaphore