5.1.5.12 SYS_MutexLock Function

Syntax

bool SYS_MutexLock(SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner);

Description

The function makes the asynchronous request to lock the mutex.

The following example code provides details about the declaration of mutex:
DECLARE_MUTEX(aesMutex);
SYS_MutexOwner_t sspOwnerOfAesMutex = {.SYS_MutexLockConf = callback};
...
if (!SYS_MutexLock(&aesMutex, &sspOwnerOfAesMutex))
return; // Wait the callback function.
// Work with the resource which is locked by the mutex.
Input Parameters
Parameter NameDescription
mutexThe pointer to the created mutex
ownerThe pointer to the owner’s structure. The owner allocates the memory for this structure. The owner cannot reuse the memory. The owner locks the mutex.
Return Type and Values
  • true – The locking operation finishes successfully.
  • false – The operation is postponed. Call the SYS_MutexLockConf() function when the mutex is locked for this owner.