Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_executor_set_scheduler_basic

Sets the scheduler of an executor.

Interface Definition

int HTL_thread_executor_set_scheduler_basic(HTL_thread_executor_t executor, HTL_thread_scheduler_t scheduler);

Description

HTL_thread_executor_set_scheduler_basic() sets scheduler to the scheduler of the executor. If configured to be automatically freed, the old scheduler associated with the executor is automatically released.

The caller must be the worker.

  • If the executor terminates, this function updates the scheduler of the executor to scheduler. When the executor restores, the scheduler specified by scheduler is used.
  • If the executor is running, the caller must run on the scheduler of the executor. The caller will be associated with the first pool of the scheduler. Users need to handle the workers in the pool associated with the old primary scheduler.

If scheduler is HTL_THREAD_SCHEDULER_NULL, a default basic scheduler with the default scheduler configuration is created.

Parameters

Parameter

Type

Description

Input/Output

executor

HTL_thread_executor

Handle to the executor.

Input

scheduler

HTL_thread_scheduler_t

Handle to the scheduler.

Input

Return Value

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

Example

   HTL_thread_executor_self(&executors[0]);
   HTL_thread_executor_set_scheduler_basic(executors[0], scheds[0]);