Beispiel #1
0
void send(PORT dest_port, void *data) {
  volatile unsigned int cpsr_flag;
  PROCESS dest;

  SAVE_CPSR_DIS_IRQ(cpsr_flag);
  assert(dest_port->magic == MAGIC_PORT);
  dest = dest_port->owner;
  assert(dest->magic == MAGIC_PCB);

  if (dest_port->open && dest->state == STATE_RECEIVE_BLOCKED) {
    /*
     * Receiver is receive blocked. We can deliver our message
     * immediately.
     */
    dest->param_proc = active_proc;
    dest->param_data = data;
    active_proc->state = STATE_REPLY_BLOCKED;
    //        kprintf("Wakeup %s, %s REPLY BLOCKED\n", dest->name,
    //        active_proc->name);
    add_ready_queue(dest);
  } else {
    /*
     * Receiver is busy or the port is closed.
     * Get on the send blocked queue of the port.
     */
    add_to_send_blocked_list(dest_port, active_proc);
    active_proc->state = STATE_SEND_BLOCKED;
    active_proc->param_data = data;
    //        kprintf("%s Send BLOCKED\n", active_proc->name);
  }
  active_proc->param_data = data;
  remove_ready_queue(active_proc);
  resign();
  RESUME_CPSR(cpsr_flag);
}
Beispiel #2
0
void send (PORT dest_port, void* data)
{
    PROCESS dest;

    assert (dest_port->magic == MAGIC_PORT);
    dest = dest_port->owner;
    assert (dest->magic == MAGIC_PCB);
    
    if (dest_port->open && dest->state == STATE_RECEIVE_BLOCKED) {
	/*
	 * Receiver is receive blocked. We can deliver our message
	 * immediately.
	 */
	dest->param_proc     = active_proc;
	dest->param_data     = data;
	active_proc->state   = STATE_REPLY_BLOCKED;
	add_ready_queue (dest);
    } else {
	/*
	 * Receiver is busy or the port is closed.
	 * Get on the send blocked queue of the port.
	 */
	add_to_send_blocked_list (dest_port, active_proc);
	active_proc->state = STATE_SEND_BLOCKED;
	active_proc->param_data = data;
    }
    active_proc->param_data = data;
    remove_ready_queue (active_proc);
    resign();
}
Beispiel #3
0
void message(PORT dest_port, void *data) {
  volatile unsigned int cpsr_flag;
  PROCESS dest;

  SAVE_CPSR_DIS_IRQ(cpsr_flag);
  assert(dest_port->magic == MAGIC_PORT);
  dest = dest_port->owner;
  assert(dest->magic == MAGIC_PCB);

  if (dest_port->open && dest->state == STATE_RECEIVE_BLOCKED) {
    dest->param_proc = active_proc;
    dest->param_data = data;
    add_ready_queue(dest);
    //        kprintf("Wakeup %s\n", dest->name);
  } else {
    /*
     * Receiver is busy or the port is closed.
     * Get on the send blocked queue of the port.
     */
    add_to_send_blocked_list(dest_port, active_proc);
    remove_ready_queue(active_proc);
    active_proc->state = STATE_MESSAGE_BLOCKED;
    active_proc->param_data = data;
    //        kprintf("%s Message BLOCKED\n", active_proc->name);
  }
  resign();
  RESUME_CPSR(cpsr_flag);
}