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
/* 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]);
}
Parent topic: Thread Functions