Maestro Audio Framework  v 1.0
NXP Semiconductors
osa_mutex.h File Reference

Contains mutex function prototypes for Impresario libosa. More...

Functions

int osa_mutex_create (OsaMutex *mutex, bool recursive)
 Create a mutex. More...
 
int osa_mutex_destroy (OsaMutex *mutex)
 Destroy a mutex. More...
 
int osa_mutex_lock (OsaMutex *mutex)
 Lock a mutex. More...
 
int osa_mutex_unlock (OsaMutex *mutex)
 Unlock a mutex. More...
 
int osa_mutex_trylock (OsaMutex *mutex)
 Try a mutex lock. More...
 

Function Documentation

◆ osa_mutex_create()

int osa_mutex_create ( OsaMutex *  mutex,
bool  recursive 
)

Create a mutex object and return to the caller. Mutex must be specified as recursive or non-recursive on creation.

Parameters
mutexA mutex object that will be created and returned to the caller
recursiveBoolean value specifying if the mutex is recursive
Return values
ERRCODE_NO_ERRORFunction succeeded
ERRCODE_OUT_OF_MEMORYOut of memory
ERRCODE_INVALID_ARGUMENTInvalid mutex object passed in
ERRCODE_TRY_AGAINSystem limits reached (Linux only)
ERRCODE_PERMISSION_DENIEDCaller does not have sufficient privilege (Linux only)
ERRCODE_GENERAL_ERRORUnexpected system error

◆ osa_mutex_destroy()

int osa_mutex_destroy ( OsaMutex *  mutex)

Free the resources associated with a mutex object.

Parameters
mutexA valid mutex object
Return values
ERRCODE_NO_ERRORFunction succeeded
ERRCODE_INVALID_ARGUMENTInvalid mutex object passed in
ERRCODE_BUSYMutex is currently locked (Linux only)

◆ osa_mutex_lock()

int osa_mutex_lock ( OsaMutex *  mutex)

Retrieve a lock on a mutex object or block until the mutex is available. If the mutex is recursive, a thread can lock it more than once.

Parameters
mutexA valid mutex object
Return values
ERRCODE_NO_ERRORFunction succeeded
ERRCODE_INVALID_ARGUMENTInvalid mutex object passed in
ERRCODE_DEADLOCKSystem has detected a deadlock (MQX only)

◆ osa_mutex_unlock()

int osa_mutex_unlock ( OsaMutex *  mutex)

Release the lock on a held mutex.

Parameters
mutexA valid mutex object
Return values
ERRCODE_NO_ERRORFunction succeeded
ERRCODE_INVALID_ARGUMENTInvalid mutex object passed in or thread does not own the mutex

◆ osa_mutex_trylock()

int osa_mutex_trylock ( OsaMutex *  mutex)

Attempt to lock a mutex but don't block if it's already locked.

Parameters
mutexA valid mutex object
Return values
ERRCODE_NO_ERRORFunction succeeded
ERRCODE_BUSYMutex is already locked by another thread
ERRCODE_DEADLOCKMutex is already locked by the calling thread (MQX only)
ERRCODE_INVALID_ARGUMENTInvalid mutex object passed in or thread does not own the mutex