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

HTL_thread_join

Waits until a thread terminates and returns a value.

Interface Definition

int HTL_thread_join(HTL_thread_t *thread, void **thread_return);

Description

HTL_thread_join() is used to wait until the target thread terminates and returns a value through thread_return.

Parameters

Parameter

Type

Description

Input/Output

thread

HTL_thread_t *

Address of the handle to the thread.

Input

thread_return

void **

Return value of thread execution.

Output

Return Value

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

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    /* Create Thread */
    for (i = 0; i < num_threads; i++) {
        arg[i] = i;
        ret = HTL_thread_create(&threads[i], NULL, thread_create, &arg[i]);
    }

    /* Join and free ULTs */
    for (i = 0; i < num_threads; i++) {
        void* retval;
        ret = HTL_thread_join(&threads[i], &retval);
        ret = HTL_thread_free(&threads[i]);
    }