void chpl_task_addToTaskList(chpl_fn_int_t fid, void *arg, c_sublocid_t subloc, chpl_task_list_p *task_list, int32_t task_list_locale, chpl_bool is_begin_stmt, int lineno, chpl_string filename) { qthread_shepherd_id_t const here_shep_id = qthread_shep(); chpl_bool serial_state = chpl_task_getSerial(); chpl_qthread_wrapper_args_t wrapper_args = {chpl_ftable[fid], arg, filename, lineno, false, {subloc, serial_state}}; assert(subloc != c_sublocid_none); PROFILE_INCR(profile_task_addToTaskList,1); if (serial_state) { syncvar_t ret = SYNCVAR_STATIC_EMPTY_INITIALIZER; qthread_fork_syncvar_copyargs_to(chapel_wrapper, &wrapper_args, sizeof(chpl_qthread_wrapper_args_t), &ret, here_shep_id); qthread_syncvar_readFF(NULL, &ret); } else if (subloc == c_sublocid_any) { qthread_fork_copyargs(chapel_wrapper, &wrapper_args, sizeof(chpl_qthread_wrapper_args_t), NULL); } else { qthread_fork_copyargs_to(chapel_wrapper, &wrapper_args, sizeof(chpl_qthread_wrapper_args_t), NULL, (qthread_shepherd_id_t) subloc); } }
void chpl_task_startMovedTask(chpl_fn_p fp, void *arg, c_sublocid_t subloc, chpl_taskID_t id, chpl_bool serial_state) { assert(subloc != c_sublocid_none); assert(id == chpl_nullTaskID); chpl_qthread_wrapper_args_t wrapper_args = {fp, arg, NULL, 0, canCountRunningTasks, PRV_DATA_IMPL_VAL(subloc, serial_state) }; PROFILE_INCR(profile_task_startMovedTask,1); if (subloc == c_sublocid_any) { qthread_fork_copyargs(chapel_wrapper, &wrapper_args, sizeof(chpl_qthread_wrapper_args_t), NULL); } else { qthread_fork_copyargs_to(chapel_wrapper, &wrapper_args, sizeof(chpl_qthread_wrapper_args_t), NULL, (qthread_shepherd_id_t) subloc); } }