HTL_thread_free
Releases a thread.
Interface Definition
int HTL_thread_free(HTL_thread_t *thread);
Description
HTL_thread_free() is used to release the resource of a ULT and set thread to HTL_THREAD_NULL. If the thread is still running, this function is blocked on the thread until the thread terminates.
An unnamed ULT will be released immediately after termination, and there is no need to release an unnamed ULT by this function. This function cannot release the primary ULT or the ULT of the primary scheduler. Only one caller can join or release the same ULT.
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
thread |
HTL_thread_t * |
Address of the handle to the thread. |
Input/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]); } |
Parent topic: Thread Functions