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

HTL_thread_mutexattr_settype

Sets mutex attributes.

Interface Definition

int HTL_thread_mutexattr_settype(HTL_thread_mutexattr_t *thread_mutexattr, int type);

Description

HTL_thread_mutexattr_settype() is used to set the mutex attribute thread_mutexattr by type (that is, whether the mutex attribute can be locked by the same owner for multiple times). When type is set to 1, the mutex attribute is recursive. When type is set to 0, the mutex attribute is non-recursive.

Parameters

Parameter

Type

Description

Input/Output

thread_mutexattr

HTL_thread_mutexattr_t *

Handle to the mutex attribute.

Input

type

int

Type.

Input

Return Value

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

Example

    HTL_thread_mutexattr_t attr;
    ret = HTL_thread_mutexattr_init(&attr);
    ret = HTL_thread_mutexattr_settype(&attr, 1);