Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_key_delete

Releases a thread private variable.

Interface Definition

int HTL_thread_key_delete(HTL_thread_key_t *thread_key);

Description

HTL_thread_key_delete() is used to release the thread private variable thread_key and set thread_key to HTL_THREAD_KEY_NULL.

Users need to clean up the memory of the value associated with the thread private variable.

The running user needs to delete the thread private variable before terminating threads that have a non-NULL value associated with the variable. The value of a deleted thread private variable cannot be referenced, but can be used in the destructor triggered by thread termination.

Parameters

Parameter

Type

Description

Input/Output

thread_key

HTL_thread_key_t *

Handle to the thread private variable specific to a worker.

Input/Output

Return Value

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

Example

1
2
3
4
    /* Delete keys */
    for (i = 0; i < NUM_TLS; i++) {
        ret = HTL_thread_key_delete(&tls[i]);
    }