EDU.oswego.cs.dl.util.concurrent
public class FIFOReadWriteLock extends java.lang.Object implements ReadWriteLock
This lock is NOT reentrant. Current readers and writers should not try to re-obtain locks while holding them.
FIFOSemaphore
Modifier and Type | Class and Description |
---|---|
protected class |
FIFOReadWriteLock.ReaderSync |
protected class |
FIFOReadWriteLock.WriterSync |
Modifier and Type | Field and Description |
---|---|
protected FIFOSemaphore |
entryLock
Fair Semaphore serving as a kind of mutual exclusion lock.
|
protected int |
exreaders
Number of threads that have exited read lock.
|
protected int |
readers
Number of threads that have entered read lock.
|
protected Sync |
readerSync |
protected Sync |
writerSync |
Constructor and Description |
---|
FIFOReadWriteLock() |
Modifier and Type | Method and Description |
---|---|
protected void |
acquireRead() |
protected void |
acquireWrite() |
protected boolean |
attemptRead(long msecs) |
protected boolean |
attemptWrite(long msecs) |
Sync |
readLock()
get the readLock
|
protected void |
releaseRead() |
protected void |
releaseWrite() |
Sync |
writeLock()
get the writeLock
|
protected final FIFOSemaphore entryLock
protected volatile int readers
protected int exreaders
protected final Sync readerSync
protected final Sync writerSync
protected void acquireRead() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void releaseRead()
protected void acquireWrite() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void releaseWrite()
protected boolean attemptRead(long msecs) throws java.lang.InterruptedException
java.lang.InterruptedException
protected boolean attemptWrite(long msecs) throws java.lang.InterruptedException
java.lang.InterruptedException
public Sync writeLock()
ReadWriteLock
writeLock
in interface ReadWriteLock
public Sync readLock()
ReadWriteLock
readLock
in interface ReadWriteLock