mirror of
https://github.com/golang/go
synced 2024-11-24 07:30:10 -07:00
runtime: use correct state machine in addAdjustedTimers
The addAdjustedTimers function was a late addition, and it got some of the state machine wrong, leading to failures like https://storage.googleapis.com/go-build-log/930576b6/windows-amd64-2016_53d0319e.log Updates #6239 Updates #27707 Change-Id: I9e94e563b4698ff3035ce609055ca292b9cab3df Reviewed-on: https://go-review.googlesource.com/c/go/+/204280 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
efd395f9fb
commit
e96fd13264
@ -989,10 +989,12 @@ func addAdjustedTimers(pp *p, moved []*timer) {
|
||||
case timerDeleted:
|
||||
// Timer has been deleted since we adjusted it.
|
||||
// This timer is already out of the heap.
|
||||
if !atomic.Cas(&t.status, s, timerRemoved) {
|
||||
if atomic.Cas(&t.status, s, timerRemoving) {
|
||||
if !atomic.Cas(&t.status, timerRemoving, timerRemoved) {
|
||||
badTimer()
|
||||
}
|
||||
break loop
|
||||
}
|
||||
case timerModifiedEarlier, timerModifiedLater:
|
||||
// Timer has been modified again since
|
||||
// we adjusted it.
|
||||
@ -1007,8 +1009,8 @@ func addAdjustedTimers(pp *p, moved []*timer) {
|
||||
if s == timerModifiedEarlier {
|
||||
atomic.Xadd(&pp.adjustTimers, -1)
|
||||
}
|
||||
}
|
||||
break loop
|
||||
}
|
||||
case timerNoStatus, timerRunning, timerRemoving, timerRemoved, timerMoving:
|
||||
badTimer()
|
||||
case timerModifying:
|
||||
|
Loading…
Reference in New Issue
Block a user