Added ClearTimeout to Event interface

graph-rework
noah metz 2023-06-19 00:33:42 -06:00
parent 04e4574cd3
commit 707501d131
1 changed files with 6 additions and 0 deletions

@ -73,6 +73,7 @@ type Event interface {
RequiredResources() []Resource RequiredResources() []Resource
DoneResource() Resource DoneResource() Resource
SetTimeout(end_time time.Time, action string) SetTimeout(end_time time.Time, action string)
ClearTimeout()
Timeout() <-chan time.Time Timeout() <-chan time.Time
TimeoutAction() string TimeoutAction() string
Signal() chan GraphSignal Signal() chan GraphSignal
@ -95,6 +96,11 @@ func (event * BaseEvent) Timeout() <-chan time.Time {
return event.timeout return event.timeout
} }
func (event * BaseEvent) ClearTimeout() {
event.timeout_action = ""
event.timeout = nil
}
func (event * BaseEvent) SetTimeout(end_time time.Time, action string) { func (event * BaseEvent) SetTimeout(end_time time.Time, action string) {
event.timeout_action = action event.timeout_action = action
event.timeout = time.After(time.Until(end_time)) event.timeout = time.After(time.Until(end_time))