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

Mutual exclusion semaphore (mutex) More...

#include <OsMutex.h>

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

Public Types

enum  MutexOptions { Q_FIFO = 0x0, Q_PRIORITY = 0x1, DELETE_SAFE = 0x4, INVERSION_SAFE = 0x8 }
 

Public Member Functions

virtual OsStatus acquire (const OsTime &rTimeout=OsTime::OS_INFINITY)=0
 Block the task until the mutex is acquired or the timeout expires. More...
 
virtual OsStatus tryAcquire (void)=0
 Conditionally acquire the mutex (i.e., don't block) More...
 
virtual OsStatus release (void)=0
 Release the mutex. More...
 
virtual void OsMutexShow (void)=0
 Print mutex 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

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

Detailed Description

Mutual exclusion semaphore (mutex)

The mutual-exclusion semaphore is a specialized version of the binary semaphore, designed to address issues inherent in mutual exclusion, such as recursive access to resources, priority inversion, and deletion safety.

The fundamental behavior of the mutual-exclusion semaphore is identical to that of a binary semaphore except for^

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

DELETE_SAFE 

protect a task that owns the mutex from < unexpected deletion

INVERSION_SAFE 

protect the system from priority inversion: NOTE < VxWorks requires Q_PRIORITY with this.

Constructor & Destructor Documentation

OsMutexBase ( )
inlineprotected

Default constructor.

virtual ~OsMutexBase ( )
inlineprotectedvirtual

Destructor.

Member Function Documentation

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

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

Implements OsSyncBase.

Implemented in OsMutexWnt, and OsMutexLinux.

virtual OsStatus tryAcquire ( void  )
pure virtual

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

Implements OsSyncBase.

Implemented in OsMutexWnt, and OsMutexLinux.

virtual OsStatus release ( void  )
pure virtual

Release the mutex.

Returns
OS_BUSY if the mutex is held by some other task

Implements OsSyncBase.

Implemented in OsMutexWnt, and OsMutexLinux.

virtual void OsMutexShow ( void  )
pure virtual

Print mutex information to the console.

Implemented in OsMutexWnt, and OsMutexLinux.