mutexLock

Synopsis

#include <sys/threads.h>

int mutexLock(handle_t h);

Status

Implemented

Conformance

Phoenix-RTOS specific

Description

The mutexLock() function shall lock the mutex referenced by h. If the mutex was already locked, the calling thread shall block until the mutex becomes available.

Return value

If successful, the mutexLock() function shall return zero; otherwise, an error number shall be returned to indicate the error.

Errors

The mutexLock() function shall fail if:

  • -EINVAL - The provided handle h does not point to a valid mutex object.

  • -EDEADLK - PH_LOCK_ERRORCHECK attribute was set and the mutex was already locked by the same thread.

  • -EAGAIN - PH_LOCK_RECURSIVE attribute was set and the mutex was already locked by the same thread.

  • -EINTR - The lock’s owner thread was destroyed.

Tests

Tested in test-sys

Known bugs

None