Files
i2p.i2p/router/java/src/org/cybergarage/util/Mutex.java
T
zzz b033db969c Revert all changes to the org/cybergarage library
in the 2009-08-11 whitespace cleanup at ef1c23821d433903124f7612cbc46ac096fc985b
to make merging with the newer library easier.
2012-05-25 19:52:39 +00:00

54 lines
927 B
Java

/******************************************************************
*
* CyberUtil for Java
*
* Copyright (C) Satoshi Konno 2002-2004
*
* File: Mutex.java
*
* Revision:
*
* 06/19/04
* - first revision.
*
******************************************************************/
package org.cybergarage.util;
public class Mutex
{
private boolean syncLock;
////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////
public Mutex()
{
syncLock = false;
}
////////////////////////////////////////////////
// lock
////////////////////////////////////////////////
public synchronized void lock()
{
while(syncLock == true) {
try {
wait();
}
catch (Exception e) {
Debug.warning(e);
};
}
syncLock = true;
}
public synchronized void unlock()
{
syncLock = false;
notifyAll();
}
}