moss.kernel
Class MWaitQueue

java.lang.Object
  extended by moss.kernel.MWaitQueue

public class MWaitQueue
extends java.lang.Object

this class implements a wait-queue. Wait-queues are used for process-context operations, such as keeping track of blocked processes inside a device-driver. This class doesn't do any scheduling itself. It doesn't do any locking itself, either. Thus, lock outside if necessary.


Constructor Summary
MWaitQueue()
          constructor -- creates an empty wait-queue
 
Method Summary
 boolean add_to_queue(MProcess p)
          adds a process to the wait-queue
 boolean del_from_queue(MProcess p)
          removes a specific process from the wait-queue
 MProcess get_from_queue()
          removes the first process from the wait-queue
 boolean is_empty()
          tests whether a queue is empty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MWaitQueue

public MWaitQueue()
constructor -- creates an empty wait-queue

Method Detail

add_to_queue

public boolean add_to_queue(MProcess p)
adds a process to the wait-queue

Parameters:
p - process to add
Returns:
true if the process was added, false if not (already there)

get_from_queue

public MProcess get_from_queue()
removes the first process from the wait-queue

Returns:
process removed, or null if empty

del_from_queue

public boolean del_from_queue(MProcess p)
removes a specific process from the wait-queue

Parameters:
p - process to remove
Returns:
true if the process was removed, false otherwise (not here)

is_empty

public boolean is_empty()
tests whether a queue is empty

Returns:
true if empty, false if waiting processes