Contains mutex function prototypes for Impresario libosa.
More...
◆ 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
-
mutex | A mutex object that will be created and returned to the caller |
recursive | Boolean value specifying if the mutex is recursive |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_OUT_OF_MEMORY | Out of memory |
ERRCODE_INVALID_ARGUMENT | Invalid mutex object passed in |
ERRCODE_TRY_AGAIN | System limits reached (Linux only) |
ERRCODE_PERMISSION_DENIED | Caller does not have sufficient privilege (Linux only) |
ERRCODE_GENERAL_ERROR | Unexpected system error |
◆ osa_mutex_destroy()
int osa_mutex_destroy |
( |
OsaMutex * |
mutex | ) |
|
Free the resources associated with a mutex object.
- Parameters
-
mutex | A valid mutex object |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_INVALID_ARGUMENT | Invalid mutex object passed in |
ERRCODE_BUSY | Mutex 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
-
mutex | A valid mutex object |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_INVALID_ARGUMENT | Invalid mutex object passed in |
ERRCODE_DEADLOCK | System has detected a deadlock (MQX only) |
◆ osa_mutex_unlock()
int osa_mutex_unlock |
( |
OsaMutex * |
mutex | ) |
|
Release the lock on a held mutex.
- Parameters
-
mutex | A valid mutex object |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_INVALID_ARGUMENT | Invalid 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
-
mutex | A valid mutex object |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_BUSY | Mutex is already locked by another thread |
ERRCODE_DEADLOCK | Mutex is already locked by the calling thread (MQX only) |
ERRCODE_INVALID_ARGUMENT | Invalid mutex object passed in or thread does not own the mutex |