Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_executor_free

Releases an executor.

Interface Definition

int HTL_thread_executor_free(HTL_thread_executor_t *executor);

Description

HTL_thread_executor_free() is used to release executor resources and set the executor to HTL_THREAD_EXECUTOR_NULL. If the executor is still running, the function is blocked until the executor terminates.

This function cannot release the executor of the running caller and the primary executor. HTL_thread_executor_join() and HTL_thread_executor_free() can block only one caller on the same executor.

Parameters

Parameter

Type

Description

Input/Output

executor

HTL_thread_executor *

Address of the handle to the executor.

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
    num_executors = NUM_EXECUTORS;
    HTL_thread_executor_t *executors;
    executors = (HTL_thread_executor_t *)malloc(sizeof(HTL_thread_executor_t) * num_executors);
    for (i = 1; i < num_executors; i++) {
        HTL_thread_executor_create_basic(HTL_THREAD_SCHEDULER_DEFAULT, 1, &g_pools[i],
            HTL_THREAD_SCHEDULER_CONFIG_NULL, &executors[i]);
    }
    for (i = 1; i < num_executors; i++) {
        HTL_thread_executor_free(&executors[i]);
    }