Docs

You are here:
OSRecursiveMutex interface

Functions

OSRecursiveMutex OSRECMUTEX_Create (void)
 
void OSRECMUTEX_Destroy (OSRecursiveMutex mutex)
 
bool OSRECMUTEX_IsValid (OSMutex mutex)
 
void OSRECMUTEX_Give (OSRecursiveMutex mutex)
 
int OSRECMUTEX_Take (OSRecursiveMutex mutex, OSTime timeout)
 

Detailed Description

An interface to a recursive mutual exclusion semaphore (recursive mutex) mechanism provided by the OS. The implementation of the OSRecursiveMutex depends on the OS used.

Function Documentation

OSRecursiveMutex OSRECMUTEX_Create ( void  )

Creates a new recursive mutex instance. The mutex implementation depends on the actual OS. A newly created mutex has no owner, it is available to be taken through a call to OSRECMUTEX_Take.

Returns
a newly created recursive mutex
void OSRECMUTEX_Destroy ( OSRecursiveMutex  mutex)

Destroys a recursive mutex

Parameters
mutexrecursive mutex to destroy
void OSRECMUTEX_Give ( OSRecursiveMutex  mutex)

Gives the recursive mutex.

Parameters
mutexrecursive mutex to give
bool OSRECMUTEX_IsValid ( OSMutex  mutex)

Checks if a recursive mutex handle represents a valid mutex. Can be used to test if OSRECMUTEX_Create produced a valid mutex. Beware, that checking handle of a mutex, that has been destroyed (OSRECMUTEX_Destroy) yields undefined behavior. On some ports such handle may still be reported as valid.

Parameters
mutexrecursive mutex to check
Returns
true if mutex is valid or false if not
int OSRECMUTEX_Take ( OSRecursiveMutex  mutex,
OSTime  timeout 
)

Takes the recursive mutex. If the mutex is not immediately available, the task from which the call was made is blocked. The maximum time spent waiting for the mutex is specified by the timeout parameter. Since the mutex is recursive, then if the mutex is obtained in a given task, the following calls to this function from within this task will also report successful mutex acquisition.

Parameters
mutexrecursive mutex to take
timeoutmaximum time spent waiting for the mutex in miliseconds
Returns
0 if the mutex was taken !0 if timeout or error occurred
Go to Top