Synopsis
unsigned ctl_mutex_lock(CTL_MUTEX_t *m,
                        CTL_TIMEOUT_t t,
                        CTL_TIME_t timeout);
Description

ctl_mutex_lock locks the mutex pointed to by m to the calling task. If the mutex is already locked by the calling task then the mutex lock count is incremented. If the mutex is already locked by a different task then the caller will block until the mutex is unlocked. In this case, if the priority of the task that has locked the mutex is less than that of the caller the priority of the task that has locked the mutex is raised to that of the caller whilst the mutex is locked. If timeoutType is non-zero and the current time reaches the timeout value before the lock is acquired the function returns zero otherwise it returns one.

Note

ctl_mutex_lock must not be called from an interrupt service routine.