Class ActionResourceLockPreempt

java.lang.Object
edu.tufts.hrilab.action.lock.ActionResourceLock
edu.tufts.hrilab.action.lock.ActionResourceLockPreempt
All Implemented Interfaces:
Serializable

public class ActionResourceLockPreempt extends ActionResourceLock
ActionResourceLockPreempt implements priority-based locks. When a higher-priority AI requests the lock, it preempts the lower-priority AI, but the lower-priority AI blocks while a higher-priority AI holds the lock.
See Also:
  • Constructor Details

    • ActionResourceLockPreempt

      public ActionResourceLockPreempt(String name)
      Constructor for a resource lock.
      Parameters:
      name - the lock's name
  • Method Details

    • acquire

      public boolean acquire(ActionInterpreter actionInt, int count)
      Make count attempts to acquire this resource lock.
      Specified by:
      acquire in class ActionResourceLock
      Parameters:
      actionInt - the ActionInterpreter requesting the lock
      count - the maximum number of attempts to acquire the lock
      Returns:
      true if the lock is successfully acquired, false otherwise