Package io.openems.common.utils
Class Mutex
- java.lang.Object
-
- io.openems.common.utils.Mutex
-
public class Mutex extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Mutex(boolean initiallyPermitted)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
await()
Wait for arelease()
.void
awaitOrTimeout(long timeout, java.util.concurrent.TimeUnit unit)
Wait for arelease()
with a timeout.void
release()
Release theMutex
.
-
-
-
Method Detail
-
await
public void await() throws java.lang.InterruptedException
Wait for arelease()
.- Throws:
java.lang.InterruptedException
- on wait error
-
awaitOrTimeout
public void awaitOrTimeout(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Wait for arelease()
with a timeout.- Parameters:
timeout
- the timeout valueunit
- the timeoutTimeUnit
- Throws:
java.lang.InterruptedException
- on wait error
-
release
public void release()
Release theMutex
.
-
-