Schedule schedules a timer for exectuion at time tm. If the timer was already scheduled, it is rescheduled.
(t Timer, tm time.Time)
| 41 | // Schedule schedules a timer for exectuion at time tm. If the |
| 42 | // timer was already scheduled, it is rescheduled. |
| 43 | func (q *Queue) Schedule(t Timer, tm time.Time) { |
| 44 | if data, ok := q.table[t]; !ok { |
| 45 | data = &timerData{t, tm, 0} |
| 46 | heap.Push(&q.heap, data) |
| 47 | q.table[t] = data |
| 48 | } else { |
| 49 | data.time = tm |
| 50 | heap.Fix(&q.heap, data.index) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // Unschedule unschedules a timer's execution. |
| 55 | func (q *Queue) Unschedule(t Timer) { |