Ejemplo n.º 1
0
void Thread::run_scheduler()
{
	process_messages();
	bool in_idle = false;
	while(!process->quit_flag) {
		process_messages();
		Net *n = process->get_net();
		if (n == NULL) {
			continue;
		}

		Transition *tr = n->pick_active_transition();
		if (tr == NULL) {
			if (!in_idle && tracelog) {
				tracelog->event_idle();
			}
			in_idle = true;
			continue;
		}
		in_idle = false;
		CA_DLOG("Transition tried id=%i process=%i thread=%i\n",
				 tr->id, get_process_id(), id);
		int res = tr->full_fire(this, n);
		if (res == NOT_ENABLED) {
			CA_DLOG("Transition is not enabled id=%i process=%i thread=%i\n",
					 tr->id, get_process_id(), id);
			tr->set_active(false);
		}
	}
}
Ejemplo n.º 2
0
void Thread::run_one_step()
{
	process_messages();
	Net *net = process->get_net();
	if (net == NULL) {
		return;
	}
	Transition *tr = net->pick_active_transition();
	if (tr == NULL) {
		return;
	}
	tr->set_active(false);
	tr->full_fire(this, net);
}