18 .get_migr_pool = NULL };
24 #ifdef ABT_CONFIG_USE_SCHED_SLEEP
25 struct timespec sleep_time;
36 return (sched_data *)data;
44 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
45 ABTI_CHECK_NULL_SCHED_PTR(p_sched);
49 abt_errno =
ABTU_malloc(
sizeof(sched_data), (
void **)&p_data);
50 ABTI_CHECK_ERROR(abt_errno);
52 #ifdef ABT_CONFIG_USE_SCHED_SLEEP
53 p_data->sleep_time.tv_sec = 0;
58 void *p_event_freq = &p_data->event_freq;
59 abt_errno = ABTI_sched_config_read(config, 1, 1, &p_event_freq);
60 if (ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS) {
62 ABTI_CHECK_ERROR(abt_errno);
66 num_pools = p_sched->num_pools;
67 p_data->num_pools = num_pools;
70 if (ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS) {
72 ABTI_CHECK_ERROR(abt_errno);
74 memcpy(p_data->pools, p_sched->pools,
sizeof(
ABT_pool) * num_pools);
76 p_sched->data = p_data;
82 ABTI_xstream *p_local_xstream =
83 ABTI_local_get_xstream(ABTI_local_get_local());
84 uint32_t work_count = 0;
92 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
96 event_freq = p_data->event_freq;
97 num_pools = p_sched->num_pools;
98 pools = p_data->pools;
105 for (i = 0; i < num_pools; i++) {
107 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
108 ABT_unit unit = ABTI_pool_pop(p_pool);
110 ABTI_xstream_run_unit(&p_local_xstream, unit, p_pool);
116 if (++work_count >= event_freq) {
117 ABTI_xstream_check_events(p_local_xstream, p_sched);
118 ABTI_local *p_local = ABTI_xstream_get_local(p_local_xstream);
119 if (ABTI_sched_has_to_stop(&p_local, p_sched) ==
ABT_TRUE)
121 p_local_xstream = ABTI_local_get_xstream(p_local);
130 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
131 ABTI_ASSERT(p_sched);
struct ABT_unit_opaque * ABT_unit
struct ABT_sched_opaque * ABT_sched
static ABT_sched_def sched_prio_def
static sched_data * sched_data_get_ptr(void *data)
static void sched_run(ABT_sched sched)
static int sched_init(ABT_sched sched, ABT_sched_config config)
struct ABT_pool_opaque * ABT_pool
static ABTU_ret_err int ABTU_malloc(size_t size, void **p_ptr)
ABTI_global * gp_ABTI_global
static int sched_free(ABT_sched)
#define SCHED_SLEEP(c, t)
struct ABT_sched_config_opaque * ABT_sched_config
static void ABTU_free(void *ptr)