java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Mutex
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Protect shared data from being accessed simultaneously by multiple threads.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
Mutex
public Mutex()Instantiate a mutex.
-
-
Method Details
-
lock
public void lock()Acquire the mutex. -
tryLock
public boolean tryLock()Attempt to acquire the mutex and immediately returnfalse
if it's unavailable.- Returns:
true
if acquired, otherwisefalse
-
unlock
public void unlock()Release the mutex.
-