static int sched_init(ABT_sched sched, ABT_sched_config config) { int abt_errno = ABT_SUCCESS; /* Default settings */ sched_data *p_data = (sched_data *)ABTU_malloc(sizeof(sched_data)); p_data->event_freq = ABTI_global_get_sched_event_freq(); #ifdef ABT_CONFIG_USE_SCHED_SLEEP p_data->sleep_time.tv_sec = 0; p_data->sleep_time.tv_nsec = ABTI_global_get_sched_sleep_nsec(); #endif /* Set the variables from the config */ ABT_sched_config_read(config, 1, &p_data->event_freq); abt_errno = ABT_sched_set_data(sched, (void *)p_data); ABTI_CHECK_ERROR(abt_errno); fn_exit: return abt_errno; fn_fail: HANDLE_ERROR_WITH_CODE("randws: sched_init", abt_errno); goto fn_exit; }
static int sched_init(ABT_sched sched, ABT_sched_config config) { int ret = ABT_SUCCESS; sched_data_t *p_data = (sched_data_t *)calloc(1, sizeof(sched_data_t)); ABT_sched_config_read(config, 2, &p_data->event_freq, &p_data->idx); ret = ABT_sched_set_data(sched, (void *)p_data); return ret; }
static int sched_init(ABT_sched sched, ABT_sched_config config) { int ret = ABT_SUCCESS; sched_data_t *p_data = (sched_data_t *)calloc(1, sizeof(sched_data_t)); /* Set the variables from the config */ ABT_sched_config_read(config, 2, &p_data->event_freq, &p_data->idx); ret = ABT_sched_set_data(sched, (void *)p_data); srand(time(NULL)); return ret; }