Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_rwlock_init

Initializes the RW lock.

Interface Definition

int HTL_thread_rwlock_init(HTL_thread_rwlock_t *thread_rwlock, const HTL_thread_rwlockattr_t *thread_rwlockattr);

Description

HTL_thread_rwlock_init() is used to initialize the read/write lock based on thread_rwlockattr and return the read/write lock handle through thread_rwlock.

The RW lock thread_rwlock must be destroyed by HTL_thread_rwlock_destroy() after being used.

Parameters

Parameter

Type

Description

Input/Output

thread_rwlock

HTL_thread_rwlock_t *

Address of the handle to the RW lock.

Output

thread_rwlockattr

HTL_thread_rwlockattr_t *

Address of the handle to the RW lock attribute.

Input

Return Value

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

Example

    HTL_thread_rwlock_t rwlock;
    ret = HTL_thread_rwlock_init(&rwlock, NULL);