Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_barrier_init

Initializes a barrier.

Interface Definition

int HTL_thread_barrier_init(HTL_thread_barrier_t *thread_barrier, HTL_thread_barrierattr_t *thread_barrierattr, uint32_t waiters);

Description

HTL_thread_barrier_init() is used to initialize a barrier based on the barrier attribute thread_barrierattr and return its handle through thread_barrier. waiters is used to specify the number of waiters, which must be greater than 0.

After thread_barrier is used, users need to destroy it by calling HTL_thread_barrier_destroy().

The barrier attribute can only be set to NULL.

Parameters

Parameter

Type

Description

Input/Output

thread_barrier

HTL_thread_barrier_t *

Address of the handle to the barrier.

Output

thread_barrierattr

HTL_thread_barrierattr_t *

Address of the handle to the barrier attribute.

Input

waiters

uint32_t

Number of waiters.

Input

Return Value

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

Example

    HTL_thread_barrier_t barrier;
    HTL_thread_barrier_init(&barrier, NULL, waiters);