psimjava
Class Waitq

java.lang.Object
  extended by psimjava.Waitq

public class Waitq
extends java.lang.Object

PsimJ Java Object-oriented simulation package, process interaction approach. (C) Jose M. Garrido, June 2000, August 2003, 2004, 2007 Class Waitq manipulates the cooperation of processes.

It allows for one of the processes (master) to dominate and the other to be treated as a slave process, held in the slave queue during the period of cooperation. Objects of this class are used as a synchronization mechanism. The queues are constructed by priorities.


Constructor Summary
Waitq(java.lang.String name, int maxprio)
          Initializes a Waitq object with its mane and the maximum priority to use
 
Method Summary
 Process coopt()
          This function returns a slave process from the slave queue.
 int length()
          Returns the length (number of processes) in the slave queue
 int lengthm()
          Returns the length (number of processes) in the master queue
 void qwait()
          Places current process in the slave queue and passivates (suspends) waiting for a process in the master queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Waitq

public Waitq(java.lang.String name,
             int maxprio)
Initializes a Waitq object with its mane and the maximum priority to use

Parameters:
name - title for the object created
maxprio - maximum priority to use
Method Detail

length

public int length()
Returns the length (number of processes) in the slave queue


lengthm

public int lengthm()
Returns the length (number of processes) in the master queue


qwait

public void qwait()
Places current process in the slave queue and passivates (suspends) waiting for a process in the master queue.


coopt

public Process coopt()
This function returns a slave process from the slave queue. If slave queue is empty, this function passivates the current (master) process.