Package ghidra.util.timer
Class Watchdog
java.lang.Object
ghidra.util.timer.Watchdog
- All Implemented Interfaces:
Closeable,AutoCloseable
A reusable watchdog that will execute a callback if the watchdog is not disarmed before
it expires.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidarm()Enables this watchdog so that atdefaultWatchdogTimeoutMSmilliseconds in the future thetimeoutMethodwill be called.voidclose()Releases the background timer that this watchdog uses.voiddisarm()Disables this watchdog.voidfinalize()booleanReturns the status of the watchdog.
-
Constructor Details
-
Watchdog
Creates a watchdog (initially disarmed) that will poll for expiration every defaultTimeoutMS milliseconds, callingtimeoutMethodwhen triggered.- Parameters:
defaultTimeoutMS- number of milliseconds that the watchdog will wait after being armed before calling the timeout method.timeoutMethod-Runnablefunctional callback.
-
-
Method Details
-
finalize
public void finalize() -
close
public void close()Releases the background timer that this watchdog uses.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
isEnabled
public boolean isEnabled()Returns the status of the watchdog.- Returns:
- true if the watchdog is armed, false if the watchdog is disarmed
-
arm
public void arm()Enables this watchdog so that atdefaultWatchdogTimeoutMSmilliseconds in the future thetimeoutMethodwill be called. -
disarm
public void disarm()Disables this watchdog.
-