Package com.github.stephengold.joltjni
Class BodyLockInterface
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.BodyLockInterface
- All Implemented Interfaces:
ConstBodyLockInterface
,ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
BodyLockInterfaceLocking
,BodyLockInterfaceNoLock
An interface to a
PhysicsSystem
that is aware of body locking.-
Method Summary
Modifier and TypeMethodDescriptionAccess the underlyingPhysicsSystem
.abstract SharedMutex
lockRead
(int bodyId) Lock the specified body for reading.abstract SharedMutex
lockWrite
(int bodyId) Lock the specified body for writing.abstract void
unlockRead
(SharedMutex mutex) Unlock the specified mutex, which was created to read a body.abstract void
unlockWrite
(SharedMutex mutex) Unlock the specified mutex, which was created to write a body.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
getSystem
Access the underlyingPhysicsSystem
.- Specified by:
getSystem
in interfaceConstBodyLockInterface
- Returns:
- the pre-existing instance
-
lockRead
Lock the specified body for reading.- Specified by:
lockRead
in interfaceConstBodyLockInterface
- Parameters:
bodyId
- the ID of the body to read- Returns:
- a new mutex
-
lockWrite
Lock the specified body for writing.- Specified by:
lockWrite
in interfaceConstBodyLockInterface
- Parameters:
bodyId
- the ID of the body to write- Returns:
- a new mutex
-