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 SharedMutexlockRead(int bodyId) Lock the specified body for reading.abstract SharedMutexlockWrite(int bodyId) Lock the specified body for writing.abstract voidunlockRead(SharedMutex mutex) Unlock the specified mutex, which was created to read a body.abstract voidunlockWrite(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, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
getSystem
Access the underlyingPhysicsSystem.- Specified by:
getSystemin interfaceConstBodyLockInterface- Returns:
- the pre-existing instance
-
lockRead
Lock the specified body for reading.- Specified by:
lockReadin interfaceConstBodyLockInterface- Parameters:
bodyId- the ID of the body to read- Returns:
- a new mutex
-
lockWrite
Lock the specified body for writing.- Specified by:
lockWritein interfaceConstBodyLockInterface- Parameters:
bodyId- the ID of the body to write- Returns:
- a new mutex
-