mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
runtime: implement resetTimer
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user