Package edu.tufts.hrilab.action.lock
Class ActionResourceLockPreempt
java.lang.Object
edu.tufts.hrilab.action.lock.ActionResourceLock
edu.tufts.hrilab.action.lock.ActionResourceLockPreempt
- All Implemented Interfaces:
Serializable
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:
-
Field Summary
Fields inherited from class edu.tufts.hrilab.action.lock.ActionResourceLock
blinkLock, faceLock, headLock, lightLock, lockName, motionLock, owner, speechLock, transmitLock, visionLock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acquire
(ActionInterpreter actionInt, int count) Makecount
attempts to acquire this resource lock.Methods inherited from class edu.tufts.hrilab.action.lock.ActionResourceLock
blockingAcquire, deepRelease, deepReleaseAll, getLock, getLockName, getOwner, nonBlockingAcquire, release, toString
-
Constructor Details
-
ActionResourceLockPreempt
Constructor for a resource lock.- Parameters:
name
- the lock's name
-
-
Method Details
-
acquire
Makecount
attempts to acquire this resource lock.- Specified by:
acquire
in classActionResourceLock
- Parameters:
actionInt
- the ActionInterpreter requesting the lockcount
- the maximum number of attempts to acquire the lock- Returns:
- true if the lock is successfully acquired, false otherwise
-