nachos.threads
Class SynchList

java.lang.Object
  extended by nachos.threads.SynchList

public class SynchList
extends Object

A synchronized queue.


Constructor Summary
SynchList()
          Allocate a new synchronized queue.
 
Method Summary
 void add(Object o)
          Add the specified object to the end of the queue.
 Object removeFirst()
          Remove an object from the front of the queue, blocking until the queue is non-empty if necessary.
static void selfTest()
          Test that this module is working.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchList

public SynchList()
Allocate a new synchronized queue.

Method Detail

add

public void add(Object o)
Add the specified object to the end of the queue. If another thread is waiting in removeFirst(), it is woken up.

Parameters:
o - the object to add. Must not be null.

removeFirst

public Object removeFirst()
Remove an object from the front of the queue, blocking until the queue is non-empty if necessary.

Returns:
the element removed from the front of the queue.

selfTest

public static void selfTest()
Test that this module is working.