18 .get_migr_pool = NULL };
24 #ifdef ABT_CONFIG_USE_SCHED_SLEEP
25 struct timespec sleep_time;
36 return (sched_data *)data;
43 ABTI_global *p_global = ABTI_global_get_global();
45 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
46 ABTI_CHECK_NULL_SCHED_PTR(p_sched);
47 ABTI_sched_config *p_config = ABTI_sched_config_get_ptr(config);
51 abt_errno =
ABTU_malloc(
sizeof(sched_data), (
void **)&p_data);
52 ABTI_CHECK_ERROR(abt_errno);
53 #ifdef ABT_CONFIG_USE_SCHED_SLEEP
54 p_data->sleep_time.tv_sec = 0;
55 p_data->sleep_time.tv_nsec = p_global->sched_sleep_nsec;
59 p_data->event_freq = p_global->sched_event_freq;
66 p_data->event_freq = event_freq;
71 num_pools = p_sched->num_pools;
72 p_data->num_pools = num_pools;
75 if (ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS) {
77 ABTI_CHECK_ERROR(abt_errno);
79 memcpy(p_data->pools, p_sched->pools,
sizeof(
ABT_pool) * num_pools);
81 p_sched->data = p_data;
87 ABTI_global *p_global = ABTI_global_get_global();
88 ABTI_xstream *p_local_xstream =
89 ABTI_local_get_xstream(ABTI_local_get_local());
90 uint32_t work_count = 0;
98 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
102 event_freq = p_data->event_freq;
103 num_pools = p_sched->num_pools;
104 pools = p_data->pools;
111 for (i = 0; i < num_pools; i++) {
113 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
117 ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
118 ABTI_ythread_schedule(p_global, &p_local_xstream, p_thread);
124 if (++work_count >= event_freq) {
125 ABTI_xstream_check_events(p_local_xstream, p_sched);
126 if (ABTI_sched_has_to_stop(p_sched) ==
ABT_TRUE)
136 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
137 ABTI_ASSERT(p_sched);