Exemplo n.º 1
0
void block_server(unsigned int port,cpu_state* state)
{
  //get the running process
  process_list* runq = remove_running(state);
  //set server as blocked
  msg_port[port]->server = runq;

}
Exemplo n.º 2
0
/* 
 * Terminate the calling thread (running) 
 * Run the next ready thread 
 */
void t_terminate(){
	if(ready_0 == NULL && ready_1 == NULL){
		t_shutdown();
	}else{
		remove_running();
		if(deq())
			setcontext(running->thread_context);
	}
}
Exemplo n.º 3
0
void block_process(unsigned int port,cpu_state* state)
{ 
  //get the running process
  process_list* runq = remove_running(state);
  
  //is it the first blocked process?
  if (msg_port[port]->bq == NULL)
  {
    //add to start of list
    msg_port[port]->bq = runq;    
  }else
  {
    //point currently last to runq
    msg_port[port]->bq_last->bq_next = runq;
  }
  //it is the last node
  msg_port[port]->bq_last = runq;
  //and doesn't have a next
  msg_port[port]->bq_last->bq_next = NULL;    
}