HTL_thread_scheduler_run_fn
Prototype of the function for running the scheduler.
Prototype
typedef void* (*HTL_thread_scheduler_run_fn)(HTL_thread_scheduler_t);
Description
Scheduler running function run() that is used to run the scheduler plan. Users can design this function as required. The function contains the following attributes:
- Scheduling cycle:
run() fetches the worker from the thread pool associated with the scheduler and runs the worker.
The scheduler can also access pools that are not associated with the scheduler. However, if HTL assumes that there is no worker in the pool associated with the scheduler, HTL treats the scheduler as idle and yields the scheduler to its parent.
- Periodical event check:
run() periodically invokes the HTL_thread_executor_check_event() function. The frequency is user-defined, but some request processing depends on HTL_thread_executor_check_event().
- Stopping run():
run() periodically calls HTL_thread_scheduler_stop(). If true is returned, run() terminates immediately. The frequency is user-defined, but some request processing depends on the mechanism of HTL_thread_scheduler_stop().
The caller of run() is the worker associated with the scheduler. If this scheduler is the primary scheduler, the underlying executor remains unchanged in run(). run() is mandatory, and users must implement this function.
Parameters
Type |
Description |
Input/Output |
|---|---|---|
HTL_thread_scheduler_t |
Handle to the scheduler. |
Input |
Return Value
- NULL: success.
- Other values: failure.