Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

marauroa
Class RWLock  view RWLock download RWLock.java

java.lang.Object
  extended bymarauroa.RWLock

public class RWLock
extends java.lang.Object

This class is a Reader/Writters lock A Reader Writer Lock is a synchronization mechanism allowing access to data. It allows multiple threads to read the data simultaneously, but only one thread at a time to update it. While a thread is updating, no other thread can read the data. The name is misleading. It may cause you to think there are two locks; in reality there is a single lock that restricts both reading and writing.


Field Summary
private  int givenLocks
           
private  java.lang.Object mutex
           
private  int waitingWriters
           
 
Constructor Summary
RWLock()
           
 
Method Summary
 void releaseLock()
           
 void requestReadLock()
           
 void requestWriteLock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

givenLocks

private int givenLocks

waitingWriters

private int waitingWriters

mutex

private java.lang.Object mutex
Constructor Detail

RWLock

public RWLock()
Method Detail

requestReadLock

public void requestReadLock()

requestWriteLock

public void requestWriteLock()

releaseLock

public void releaseLock()