runtime: implement resetTimer

This commit is contained in:
Joe Shaw
2022-08-24 12:19:31 -04:00
committed by Ron Evans
parent 303410d3fc
commit f439514703
3 changed files with 27 additions and 0 deletions
+9
View File
@@ -13,6 +13,7 @@ func (t *timerNode) whenTicks() timeUnit {
}
// Defined in the time package, implemented here in the runtime.
//
//go:linkname startTimer time.startTimer
func startTimer(tim *timer) {
addTimer(&timerNode{
@@ -48,3 +49,11 @@ func timerCallback(tn *timerNode) {
func stopTimer(tim *timer) bool {
return removeTimer(tim)
}
//go:linkname resetTimer time.resetTimer
func resetTimer(tim *timer, when int64) bool {
tim.when = when
removed := removeTimer(tim)
startTimer(tim)
return removed
}