|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object BSsync.Lock
public class Lock
A simple non-reentrant mutual exclusion lock. The lock is free upon construction. Each acquire gets the lock, and each release frees it. Releasing a lock that is already free has no effect.
This implementation makes no attempt to provide any fairness or ordering guarantees.
Semaphore
Field Summary | |
---|---|
protected boolean |
inuse
The lock status |
static boolean |
verbose
Set this variable to true for debugging output |
Constructor Summary | |
---|---|
Lock()
Constructor for a mutex lock. |
|
Lock(java.lang.String name)
Constructor for a mutex lock with a given name. |
Method Summary | |
---|---|
void |
lock()
Acquire the mutex lock. |
Condition |
newCondition()
Create and return a new condition variable associated with this lock. |
Condition |
newCondition(java.lang.String name)
Create and return a new condition variable associated with this lock. |
void |
unlock()
Release the mutex lock. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean verbose
protected boolean inuse
Constructor Detail |
---|
public Lock()
public Lock(java.lang.String name)
name
- name of the mutexMethod Detail |
---|
public void lock()
public void unlock()
public Condition newCondition()
public Condition newCondition(java.lang.String name)
name
- name of the Condition object.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |