Class BodyLockInterface

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<ConstJoltPhysicsObject>
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(ConstBodyId bodyId)
      Lock the specified body for reading.
      Parameters:
      bodyId - the body to read (not null, unaffected)
      Returns:
      a new mutex
    • lockWrite

      public abstract SharedMutex lockWrite(ConstBodyId bodyId)
      Lock the specified body for writing.
      Parameters:
      bodyId - the body to write (not null, unaffected)
      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)