• Emmanuel Odeke's avatar
    runtime: return deltimer early if timer.timersBucket is unset · a72e26f2
    Emmanuel Odeke authored
    Return early from deltimer, with false as the result,
    to indicate that we couldn't delete the timer since its
    timersBucket was nil(not set) in the first place.
    
    That happens in such a case where a user created
    the timer from a Ticker with:
    
      t := time.Ticker{C: c}
    
    The above usage skips the entire setup of assigning
    the appropriate underlying runtimeTimer and timersBucket,
    steps that are done for us by time.NewTicker.
    
    CL 34784 introduced this bug with an optimization, by changing
    stopTimer to retrieve the timersBucket from the timer itself
    (which is unset with the mentioned usage pattern above),
    whereas the old  behavior relied on indexing
    by goroutine ID into the global slice of runtime
    timers, to retrieve the appropriate timersBucket.
    
    Fixes #21874
    
    Change-Id: Ie9ccc6bdee685414b2430dc4aa74ef618cea2b33
    Reviewed-on: https://go-review.googlesource.com/63970
    Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    a72e26f2
Name
Last commit
Last update
..
example_test.go Loading commit data...
export_android_test.go Loading commit data...
export_test.go Loading commit data...
export_windows_test.go Loading commit data...
format.go Loading commit data...
format_test.go Loading commit data...
genzabbrs.go Loading commit data...
internal_test.go Loading commit data...
mono_test.go Loading commit data...
sleep.go Loading commit data...
sleep_test.go Loading commit data...
sys_plan9.go Loading commit data...
sys_unix.go Loading commit data...
sys_windows.go Loading commit data...
tick.go Loading commit data...
tick_test.go Loading commit data...
time.go Loading commit data...
time_test.go Loading commit data...
zoneinfo.go Loading commit data...
zoneinfo_abbrs_windows.go Loading commit data...
zoneinfo_android.go Loading commit data...
zoneinfo_android_test.go Loading commit data...
zoneinfo_ios.go Loading commit data...
zoneinfo_plan9.go Loading commit data...
zoneinfo_read.go Loading commit data...
zoneinfo_test.go Loading commit data...
zoneinfo_unix.go Loading commit data...
zoneinfo_windows.go Loading commit data...
zoneinfo_windows_test.go Loading commit data...