HTL_thread_scheduler_stop
检查调度器是否需要停止。
接口定义
int HTL_thread_scheduler_stop(HTL_thread_scheduler_t scheduler, bool *is_stop);
描述
HTL_thread_scheduler_stop()用于检查调度器scheduler是否需要停止。
- 如果需要停止scheduler,则将is_stop设置为true。否则,is_stop设置为false。
 - 如果sched未运行,则is_stop为未定义的值。
 
参数
参数名  | 
类型  | 
描述  | 
输入/输出  | 
|---|---|---|---|
scheduler  | 
HTL_thread_scheduler_t  | 
调度器句柄。  | 
输入  | 
is_stop  | 
bool *  | 
调度器是否需要停止。  | 
输出  | 
返回值
- HTL_THREAD_SUCCESS:成功。
 - 其他:失败。见错误码定义。
 
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  | 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); }  | 
父主题: 调度器函数