@@ -190,7 +190,7 @@ func timeSleep(ns int64) {
190
190
// timer function, goroutineReady, before the goroutine has been parked.
191
191
func resetForSleep (gp * g , ut unsafe.Pointer ) bool {
192
192
t := (* timer )(ut )
193
- resettimer ( t , t .nextWhen )
193
+ t . reset ( t .nextWhen )
194
194
return true
195
195
}
196
196
@@ -204,15 +204,15 @@ func startTimer(t *timer) {
204
204
if t .state .Load () != 0 {
205
205
throw ("startTimer called with initialized timer" )
206
206
}
207
- resettimer ( t , t .when )
207
+ t . reset ( t .when )
208
208
}
209
209
210
210
// stopTimer stops a timer.
211
211
// It reports whether t was stopped before being run.
212
212
//
213
213
//go:linkname stopTimer time.stopTimer
214
214
func stopTimer (t * timer ) bool {
215
- return deltimer ( t )
215
+ return t . stop ( )
216
216
}
217
217
218
218
// resetTimer resets an inactive timer, adding it to the heap.
@@ -224,14 +224,14 @@ func resetTimer(t *timer, when int64) bool {
224
224
if raceenabled {
225
225
racerelease (unsafe .Pointer (t ))
226
226
}
227
- return resettimer ( t , when )
227
+ return t . reset ( when )
228
228
}
229
229
230
230
// modTimer modifies an existing timer.
231
231
//
232
232
//go:linkname modTimer time.modTimer
233
233
func modTimer (t * timer , when , period int64 ) {
234
- modtimer ( t , when , period , t .f , t .arg , t .seq )
234
+ t . modify ( when , period , t .f , t .arg , t .seq )
235
235
}
236
236
237
237
// Go runtime.
@@ -263,11 +263,11 @@ func doaddtimer(pp *p, t *timer) {
263
263
pp .numTimers .Add (1 )
264
264
}
265
265
266
- // deltimer deletes the timer t. It may be on some other P, so we can't
267
- // actually remove it from the timers heap. We can only mark it as deleted .
266
+ // stop deletes the timer t. It may be on some other P, so we can't
267
+ // actually remove it from the timers heap. We can only mark it as stopped .
268
268
// It will be removed in due course by the P whose heap it is on.
269
- // Reports whether the timer was removed before it was run.
270
- func deltimer (t * timer ) bool {
269
+ // Reports whether the timer was stopped before it was run.
270
+ func (t * timer ) stop ( ) bool {
271
271
state , mp := t .lock ()
272
272
if state & timerHeaped != 0 && (state & timerNextWhen == 0 || t .nextWhen != 0 ) {
273
273
// Timer pending: stop it.
@@ -310,10 +310,10 @@ func dodeltimer0(pp *p) {
310
310
}
311
311
}
312
312
313
- // modtimer modifies an existing timer.
313
+ // modify modifies an existing timer.
314
314
// This is called by the netpoll code or time.Ticker.Reset or time.Timer.Reset.
315
315
// Reports whether the timer was modified before it was run.
316
- func modtimer (t * timer , when , period int64 , f func (any , uintptr ), arg any , seq uintptr ) bool {
316
+ func (t * timer ) modify ( when , period int64 , f func (any , uintptr ), arg any , seq uintptr ) bool {
317
317
if when <= 0 {
318
318
throw ("timer when must be positive" )
319
319
}
@@ -377,11 +377,11 @@ func modtimer(t *timer, when, period int64, f func(any, uintptr), arg any, seq u
377
377
return pending
378
378
}
379
379
380
- // resettimer resets the time when a timer should fire.
380
+ // reset resets the time when a timer should fire.
381
381
// If used for an inactive timer, the timer will become active.
382
382
// Reports whether the timer was active and was stopped.
383
- func resettimer (t * timer , when int64 ) bool {
384
- return modtimer ( t , when , t .period , t .f , t .arg , t .seq )
383
+ func (t * timer ) reset ( when int64 ) bool {
384
+ return t . modify ( when , t .period , t .f , t .arg , t .seq )
385
385
}
386
386
387
387
// cleantimers cleans up the head of the timer queue. This speeds up
0 commit comments