|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.emulator.util.RWLock
public final class RWLock
A reader/writer lock. This lock will allow multiple readers, but only a single writer. TO DO: - prevent starvation of writers (will only happen under severe circumstances, but it should be made impossible)
Field Summary | |
---|---|
private ArrayList |
readers
|
private int |
writeLockDepth
|
private Thread |
writer
|
Constructor Summary | |
---|---|
RWLock()
|
Method Summary | |
---|---|
void |
readLock()
Obtain a read lock. |
void |
release()
Release the lock. |
void |
verifyReadLock()
Verifies that the current thread holds a read lock. |
void |
verifyWriteLock()
Verifies that the current thread holds a write lock. |
void |
writeLock()
Obtain an exclusive write lock. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ArrayList readers
private Thread writer
private int writeLockDepth
Constructor Detail |
---|
public RWLock()
Method Detail |
---|
public final void readLock()
public final void writeLock()
public final void release()
public final void verifyReadLock()
public final void verifyWriteLock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |