Struct InterruptibleSleepInterface
Defined in File interruptible_sleep_interface.h
Inheritance Relationships
Derived Types
public cras::InterruptibleTFBuffer(Class InterruptibleTFBuffer)public cras::StatefulNodeletInterface(Struct StatefulNodeletInterface)
Struct Documentation
-
struct InterruptibleSleepInterface
Interface to an object whose
sleep()calls can be interrupted externally. Multiplesleep()calls can be happening at a time. The object waits for the lastsleep()call to finish on destruction. No moresleep()calls can be made once destruction of the object started (sleep()will return false in such case). Make sure thatok()returns false when this object is about to be destroyed.Subclassed by cras::InterruptibleTFBuffer, cras::StatefulNodeletInterface
Public Functions
-
InterruptibleSleepInterface()
-
virtual ~InterruptibleSleepInterface()
Destroy the object waiting for a pending
sleep()call to finish.
-
virtual bool sleep(const ::ros::Duration &duration) const
Sleep for the given duration or until
ok()returns false.- Parameters:
duration – [in] The duration to sleep for.
- Returns:
Whether the requested duration has elapsed.
-
virtual bool ok() const
Whether it is OK to continue sleeping. If false, a pending
sleep()should stop as soon as possible.Note
Always override this function as its default implementation returns false (used in case this function is called after the descendant parts of the objects have already been destructed).
- Returns:
Whether it is OK to continue.
-
InterruptibleSleepInterface()