// fixme: move to task.c int exec(int argc, char *argv[]) { int ret; const struct command *exe; struct task *current; int (*main)(int, char *[]); // fixme for (exe = build_in_cmd; exe < build_in_cmd + ARRAY_ELEM_NUM(build_in_cmd); exe++) { if (!strncmp(exe->name, argv[0], MAX_ARG_LEN)) { goto L1; } } for (exe = g_exe_begin; exe < g_exe_end; exe++) { if (!strncmp(exe->name, argv[0], MAX_ARG_LEN)) { goto L1; } } printf(" command \"%s\" not found!\n" " Please use \"help\" to get g-bios command list.\n", argv[0]); return -ENOEXEC; L1: main = exe->main; if (!main) return -EINVAL; current = malloc(sizeof(*current)); if (!current) return -ENOMEM; current->argc = argc; current->argv = argv; current->exe = exe; current->help = get_help(argv[0]); // fixme set_current_task(current); getopt_init(); ret = main(argc, argv); set_current_task(NULL); free(current); return ret; }
void Fsm::set_event(const char * event) { // move based on event for(int i = 0; i < edge_count; i++) { if(equals( edges[i].from, current_task->name ) && equals( edges[i].event, event )) { set_current_task(edges[i].to); break; } } }
void uniproc_will_exit(void) { UNIPROC_ASSERT(uniproc_holder == current); UNIPROC_ASSERT(uniproc_holder_cthread == cthread_self()); set_current_task(current); current_set[smp_processor_id()] = (struct task_struct *) NULL; #if CONFIG_OSFMACH3_DEBUG uniproc_holder = NULL; #endif /* CONFIG_OSFMACH3_DEBUG */ uniproc_holder_cthread = NULL; }
static __inline__ void uniproc_change_current( struct task_struct *old_task, struct task_struct *new_task) { UNIPROC_ASSERT(uniproc_holder != NULL); UNIPROC_ASSERT(uniproc_holder == old_task); ASSERT(current == old_task); current_set[smp_processor_id()] = new_task; set_current_task(current); #if CONFIG_OSFMACH3_DEBUG uniproc_holder = current; #endif /* CONFIG_OSFMACH3_DEBUG */ uniproc_holder_cthread = cthread_self(); }
CBinaryLabels* CMultitaskCompositeMachine::apply_locked_binary(SGVector<index_t> indices) { int n_tasks = m_task_group->get_num_tasks(); SGVector<float64_t> result(indices.vlen); result.zero(); for (int32_t i=0; i<indices.vlen; i++) { for (int32_t j=0; j<n_tasks; j++) { if (m_tasks_indices[j].count(indices[i])) { set_current_task(j); result[i] = apply_one(indices[i]); break; } } } return new CBinaryLabels(result); }