Class BodyLockInterface

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>
Direct Known Subclasses:
BodyLockInterfaceLocking, BodyLockInterfaceNoLock

public abstract class BodyLockInterface extends NonCopyable
An interface to a PhysicsSystem that is aware of body locking.
  • Method Details

    • getSystem

      public PhysicsSystem getSystem()
      Access the underlying PhysicsSystem.
      Returns:
      the pre-existing instance
    • lockRead

      public abstract SharedMutex lockRead(int bodyId)
      Lock the specified body for reading.
      Parameters:
      bodyId - the ID of the body to read
      Returns:
      a new mutex
    • lockWrite

      public abstract SharedMutex lockWrite(int bodyId)
      Lock the specified body for writing.
      Parameters:
      bodyId - the ID of the body to write
      Returns:
      a new mutex
    • unlockRead

      public abstract void unlockRead(SharedMutex mutex)
      Unlock the specified mutex, which was created to read a body.
      Parameters:
      mutex - the mutex to unlock (not null)
    • unlockWrite

      public abstract void unlockWrite(SharedMutex mutex)
      Unlock the specified mutex, which was created to write a body.
      Parameters:
      mutex - the mutex to unlock (not null)