예제 #1
0
/* remove a thread from a process running threads list */
void remove_process_thread(struct w32process *process, struct w32thread *thread)
{
	list_remove(&thread->proc_entry);

	if (!--process->running_threads) {
		/* we have removed the last running thread, exit the process */
		process->exit_code = thread->exit_code;
		close(process->dummyfd);
		process->dummyfd = -1;
		process_killed(process);
	}
	release_object(thread);
}
예제 #2
0
static void handle_event(nge_event * e)
{
	switch (e->state_type) {
	case PING:
		ping();
		return;

	case SERVICE_STATE_CHANGE:
	case INITIAL_SERVICE_STATE_CHANGE:
		service_change(e->payload.service_state_change.service,
			       e->payload.service_state_change.is,
			       e->payload.service_state_change.state_name,
			       e->payload.service_state_change.percent_started,
			       e->payload.service_state_change.percent_stopped,
			       e->payload.service_state_change.service_type,
			       e->payload.service_state_change.hidden);
		return;

	case SYSTEM_STATE_CHANGE:
	case INITIAL_SYSTEM_STATE_CHANGE:
		sys_state(e->payload.system_state_change.system_state,
			  e->payload.system_state_change.runlevel);
		return;

	case ERR_MSG:
		err_msg(e->payload.err_msg.mt,
			e->payload.err_msg.file,
			e->payload.err_msg.func,
			e->payload.err_msg.line, e->payload.err_msg.message);
		return;

	case CONNECT:
		connected(e->payload.connect.pver,
			  e->payload.connect.initng_version);
		return;

	case DISCONNECT:
		disconnected();
		return;

	case INITIAL_STATE_FINISHED:
		initial_state_finished();
		return;

	case SERVICE_OUTPUT:
		service_output(e->payload.service_output.service,
			       e->payload.service_output.process,
			       e->payload.service_output.output);
		return;

	case PROCESS_KILLED:
		process_killed(e->payload.process_killed.service,
			       e->payload.process_killed.is,
			       e->payload.process_killed.state_name,
			       e->payload.process_killed.process,
			       e->payload.process_killed.exit_status,
			       e->payload.process_killed.term_sig);
		return;

	default:
		return;
	}
}