1.4.4.9 OSAL_MUTEX_Create Function

C

OSAL_RESULT OSAL_MUTEX_Create(OSAL_MUTEX_HANDLE_TYPE* mutexID)

Summary

Creates a mutex.

Description

This function creates a mutex, allocating storage if required and placing the mutex handle into the passed parameter.

Precondition

Mutex must have been declared.

Parameters

ParamDescription
mutexIDPointer to the mutex handle

Returns

OSAL_RESULT_TRUE - Mutex successfully created

OSAL_RESULT_FALSE - Mutex failed to be created

Example

OSAL_MUTEX_HANDLE_TYPE mutexData;

OSAL_MUTEX_Create(&mutexData);
...
if (OSAL_MUTEX_Lock(&mutexData, 1000) == OSAL_RESULT_TRUE)
{
    // manipulate the shared data
    ...
}

Remarks

None.