mirror of
https://github.com/i2p/i2p.i2p.git
synced 2024-12-06 19:27:00 +01:00
b033db969c
in the 2009-08-11 whitespace cleanup at ef1c23821d433903124f7612cbc46ac096fc985b to make merging with the newer library easier.
54 lines
927 B
Java
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();
|
|
}
|
|
|
|
} |