|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.realtime.WaitFreeReadQueue
The wait-free queue classes facilitate communication and synchronization
between instances of RealtimeThread
and Thread
.
The problem is that synchronized access
objects shared between real-time threads and threads might cause the real-time threads to
incur delays due to execution of the garbage collector.
The read()
method of
this class does not block on an imagined queue-empty condition variable. If the
read()
is called on an empty queue null is returned. If two
real-time threads intend to read from this queue they must provide their own
synchronization.
The write method of this queue is synchronized and may be called by more than one writer and will block on queue empty.
Constructor Summary | |
WaitFreeReadQueue(java.lang.Thread writer,
java.lang.Thread reader,
int maximum,
MemoryArea memory)
A queue with an unsynchronized and nonblocking read() method and a
synchronized and blocking write() method. |
|
WaitFreeReadQueue(java.lang.Thread writer,
java.lang.Thread reader,
int maximum,
MemoryArea memory,
boolean notify)
A queue with an unsynchronized and nonblocking read() method and a
synchronized and blocking write() method. |
Method Summary | |
void |
clear()
Set this to empty. |
boolean |
isEmpty()
Used to determine if this is empty. |
boolean |
isFull()
Used to determine if this is full. |
java.lang.Object |
read()
Returns the next element in the queue unless the queue is empty. |
int |
size()
Used to determine the number of elements in this. |
void |
waitForData()
If this is empty waitForData() waits on the event until the writer
inserts data. |
boolean |
write(java.lang.Object object)
The synchronized and blocking write. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WaitFreeReadQueue(java.lang.Thread writer, java.lang.Thread reader, int maximum, MemoryArea memory, boolean notify) throws java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException
read()
method and a
synchronized and blocking write()
method.writer
- An instance of Thread
.reader
- An instance of Thread
.maximum
- The maximum number of elements in the queue.memory
- The MemoryArea
in which this object and internal elements are stored.notify
- Whether or not the reader is notified when data is added.public WaitFreeReadQueue(java.lang.Thread writer, java.lang.Thread reader, int maximum, MemoryArea memory) throws java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException
read()
method and a
synchronized and blocking write()
method.
The memory areas of the given threads are found. If these memory areas are
the same the queue is created in that memory area. If these memory areas are
different the queue is created in the memory area accessible by the most
restricted thread type.writer
- An instance of Thread
.reader
- An instance of Thread
.maximum
- The maximum number of elements in the queue.memory
- The MemoryArea
in which this object and internal elements are stored.Method Detail |
public void clear()
public boolean isEmpty()
public boolean isFull()
public java.lang.Object read()
public int size()
public void waitForData()
waitForData()
waits on the event until the writer
inserts data. Note that true priority inversion does not occur since
the writer locks a different object and the notify is executed by
the AsyncEventHandler
which has noHeap
characteristics.public boolean write(java.lang.Object object) throws MemoryScopeException
object
- The Object
that is placed in this.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |