ClearTimeout clears the timeout specified by the id. Returns true if the timeout is found.
(id int)
| 59 | // ClearTimeout clears the timeout specified by the id. |
| 60 | // Returns true if the timeout is found. |
| 61 | func (tm *TimerManager) ClearTimeout(id int) bool { |
| 62 | |
| 63 | for pos, t := range tm.timers { |
| 64 | if t.id == id { |
| 65 | copy(tm.timers[pos:], tm.timers[pos+1:]) |
| 66 | tm.timers[len(tm.timers)-1] = timeout{} |
| 67 | tm.timers = tm.timers[:len(tm.timers)-1] |
| 68 | return true |
| 69 | } |
| 70 | } |
| 71 | return false |
| 72 | } |
| 73 | |
| 74 | // ProcessTimers should be called periodically to process the timers |
| 75 | func (tm *TimerManager) ProcessTimers() { |