19 .get_migr_pool = NULL,
24 #ifdef ABT_CONFIG_USE_SCHED_SLEEP 25 struct timespec sleep_time;
38 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
39 ABTI_CHECK_NULL_SCHED_PTR(p_sched);
42 sched_data *p_data = (sched_data *)
ABTU_malloc(
sizeof(sched_data));
43 p_data->event_freq = ABTI_global_get_sched_event_freq();
44 #ifdef ABT_CONFIG_USE_SCHED_SLEEP 45 p_data->sleep_time.tv_sec = 0;
46 p_data->sleep_time.tv_nsec = ABTI_global_get_sched_sleep_nsec();
50 void *p_event_freq = &p_data->event_freq;
51 ABTI_sched_config_read(config, 1, 1, &p_event_freq);
53 p_sched->data = p_data;
65 ABTI_local *p_local = ABTI_local_get_local();
66 uint32_t work_count = 0;
72 unsigned seed = time(NULL);
75 ABTI_xstream *p_xstream = p_local->p_xstream;
76 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
79 p_data = (sched_data *)p_sched->data;
80 num_pools = p_sched->num_pools;
82 memcpy(p_pools, p_sched->pools,
sizeof(
ABT_pool) * num_pools);
89 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
90 unit = ABTI_pool_pop(p_pool);
92 ABTI_xstream_run_unit(&p_local, p_xstream, unit, p_pool);
94 }
else if (num_pools > 1) {
97 (num_pools == 2) ? 1 : (rand_r(&seed) % (num_pools - 1) + 1);
98 pool = p_pools[target];
99 p_pool = ABTI_pool_get_ptr(pool);
100 unit = ABTI_pool_pop(p_pool);
103 ABTI_unit_set_associated_pool(unit, p_pool);
104 ABTI_xstream_run_unit(&p_local, p_xstream, unit, p_pool);
109 if (++work_count >= p_data->event_freq) {
111 ABTI_sched_has_to_stop(&p_local, p_sched, p_xstream);
115 ABTI_xstream_check_events(p_xstream, sched);
125 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
126 ABTI_ASSERT(p_sched);
128 sched_data *p_data = (sched_data *)p_sched->data;
struct ABT_unit_opaque * ABT_unit
struct ABT_sched_opaque * ABT_sched
static void sched_run(ABT_sched sched)
static void * ABTU_malloc(size_t size)
#define LOG_EVENT_POOL_POP(p_pool, unit)
struct ABT_pool_opaque * ABT_pool
static int sched_free(ABT_sched)
#define HANDLE_ERROR_WITH_CODE(msg, n)
#define SCHED_SLEEP(c, t)
struct ABT_sched_config_opaque * ABT_sched_config
static ABT_sched_def sched_randws_def
static void ABTU_free(void *ptr)
static int sched_init(ABT_sched sched, ABT_sched_config config)