HTL_thread_scheduler_stop

检查调度器是否需要停止。

接口定义

int HTL_thread_scheduler_stop(HTL_thread_scheduler_t scheduler, bool *is_stop);

描述

HTL_thread_scheduler_stop()用于检查调度器scheduler是否需要停止。

参数

参数名

类型

描述

输入/输出

scheduler

HTL_thread_scheduler_t

调度器句柄。

输入

is_stop

bool *

调度器是否需要停止。

输出

返回值

示例

static void sched_run(HTL_thread_scheduler_t sched)
{
    uint32_t work_count = 0;
    sched_data_t *p_data;
    int num_pools;
    HTL_thread_pool_t *pools;
    bool is_stop;

    HTL_thread_scheduler_get_pool_count(sched, &num_pools);
    pools = (HTL_thread_pool_t *)malloc(num_pools * sizeof(HTL_thread_pool_t));
    HTL_thread_scheduler_get_pools(sched, num_pools, 0, pools);
    while (1) {
        ... ...
        if (!(++work_count & sched_event_freq_mask)) {
            HTL_thread_scheduler_stop(sched, &is_stop);
            if (is_stop == true)
                break;
            HTL_thread_executor_check_event(sched);
        }
    }
    free(pools);
}