Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_executor_run_worker

Runs the worker.

Interface Definition

int HTL_thread_executor_run_worker(HTL_worker_t worker, HTL_thread_pool_t thread_pool);

Description

HTL_thread_executor_run_worker() associates the worker with a thread pool (thread_pool) and runs the worker as a leaf ULT on the caller ULT (parent ULT). When the worker completes or exits, the caller ULT resumes running.

Parameters

Parameter

Type

Description

Input/Output

worker

HTL_worker_t

Handle to the worker.

Input

thread_pool

HTL_thread_pool_t

Handle to the thread pool.

Input

Return Value

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

Example

    HTL_worker_t unit;
    while (1) {
        /* Execute one work unit from the scheduler's pool */
        HTL_thread_pool_pop(pools[0], &unit);
        if (unit != HTL_THREAD_WORKER_NULL) {
            HTL_thread_executor_run_worker(unit, pools[0]);
        } 
        ...
    }