我要评分
获取效率
正确性
完整性
易理解

HTL_thread_mutex_lock

Locks a mutex.

Interface Definition

int HTL_thread_mutex_lock(HTL_thread_mutex_t *thread_mutex);

Description

HTL_thread_mutex_lock() is used to lock the mutex thread_mutex. If a success message is returned, the caller obtains the mutex. If the mutex has been locked, the caller is blocked until the mutex is available.

If thread_mutex is recursive, the same caller can obtain multi-level ownership of the mutex. The mutex remains locked until it is unlocked as many times as the ownership level.

Parameters

Parameter

Type

Description

Input/Output

thread_mutex

HTL_thread_mutex_t *

Address of the handle to the mutex.

Input

Return Value

  • HTL_THREAD_SUCCESS: success.
  • Other values: failure. For details, see the error code descriptions.

Example

    int ret;
    ret = HTL_thread_mutex_lock(&mutex);
    if ( ret != HTL_THREAD_SUCCESS) return;