org.jikesrvm.scheduler
Class ThreadQueue

java.lang.Object
  extended by org.jikesrvm.scheduler.ThreadQueue

public class ThreadQueue
extends Object

An unsynchronized queue data structure for Threads. The current uses are all where there is some other lock that already protects the queue.


Field Summary
(package private)  RVMThread head
           
(package private)  RVMThread tail
           
protected static boolean trace
           
 
Constructor Summary
ThreadQueue()
           
 
Method Summary
 RVMThread dequeue()
           
 void dump()
           
 void enqueue(RVMThread t)
           
private  RVMThread getNext(RVMThread cur)
          Private helper.
 boolean isEmpty()
           
 boolean isQueued(RVMThread t)
           
 RVMThread peek()
           
 boolean remove(RVMThread t)
          Remove the given thread from the queue if the thread is still on the queue.
private  void setNext(RVMThread cur, RVMThread value)
          Private helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trace

protected static final boolean trace
See Also:
Constant Field Values

head

RVMThread head

tail

RVMThread tail
Constructor Detail

ThreadQueue

public ThreadQueue()
Method Detail

isEmpty

public boolean isEmpty()

enqueue

public void enqueue(RVMThread t)

peek

public RVMThread peek()

dequeue

public RVMThread dequeue()

getNext

private RVMThread getNext(RVMThread cur)
Private helper. Gets the next pointer of cur unless cur is null, in which case it returns head.


setNext

private void setNext(RVMThread cur,
                     RVMThread value)
Private helper. Sets the next pointer of cur to value unless cur is null, in which case it sets head. Also sets tail as appropriate.


remove

public boolean remove(RVMThread t)
Remove the given thread from the queue if the thread is still on the queue. Does nothing (and returns in O(1)) if the thread is not on the queue. Also does nothing (and returns in O(1)) if the thread is on a different queue.


isQueued

public boolean isQueued(RVMThread t)

dump

public void dump()