/* * This function simply stops the service p. * @param s A Service_T object * @return TRUE if the service was stopped otherwise FALSE */ static int do_stop(Service_T s) { ASSERT(s); if(s->depend_visited) return TRUE; s->depend_visited= TRUE; monitor_unset(s); if(s->type==TYPE_PROCESS) { /* Reset the proc info object in case of a later restart */ memset(s->procinfo, 0, sizeof *(s->procinfo)); } if(s->stop && (s->type!=TYPE_PROCESS || is_process_running(s))) { log("stop: (%s) %s\n", s->name, s->stop->arg[0]); spawn(s, s->stop, "Stopped"); if(s->type==TYPE_PROCESS) { /* Only wait for process service types */ return wait_stop(s); } } return TRUE; }
/* * This function simply stops the service p. * @param s A Service_T object * @return TRUE if the service was stopped otherwise FALSE */ static int do_stop(Service_T s) { ASSERT(s); if (s->depend_visited) return TRUE; s->depend_visited = TRUE; /* do soft unmonitor - start counter and error state is kept */ if (s->monitor != MONITOR_NOT) { s->monitor = MONITOR_NOT; DEBUG("Monitoring disabled -- service %s\n", s->name); } if (s->stop && (s->type!=TYPE_PROCESS || Util_isProcessRunning(s))) { LogInfo("'%s' stop: %s\n", s->name, s->stop->arg[0]); spawn(s, s->stop, NULL); if (s->type == TYPE_PROCESS) { /* Only wait for process service types */ if (!wait_stop(s)) return FALSE; } } Util_resetInfo(s); return TRUE; }
/* Called by Simulation code, dispatches task and stops the ready/wait timers */ void Dispatch(int *pid) { start_overhead(); task_t *t = __dispatch(pid); ready_stop(t); if(t->last_state == WAIT){ wait_stop(t); } t->last_state = RUNNING; stop_overhead(); }