mirror of
https://github.com/golang/go
synced 2024-11-18 04:14:49 -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:
|
case timerDeleted:
|
||||||
// Timer has been deleted since we adjusted it.
|
// Timer has been deleted since we adjusted it.
|
||||||
// This timer is already out of the heap.
|
// This timer is already out of the heap.
|
||||||
if !atomic.Cas(&t.status, s, timerRemoved) {
|
if atomic.Cas(&t.status, s, timerRemoving) {
|
||||||
badTimer()
|
if !atomic.Cas(&t.status, timerRemoving, timerRemoved) {
|
||||||
|
badTimer()
|
||||||
|
}
|
||||||
|
break loop
|
||||||
}
|
}
|
||||||
break loop
|
|
||||||
case timerModifiedEarlier, timerModifiedLater:
|
case timerModifiedEarlier, timerModifiedLater:
|
||||||
// Timer has been modified again since
|
// Timer has been modified again since
|
||||||
// we adjusted it.
|
// we adjusted it.
|
||||||
@ -1007,8 +1009,8 @@ func addAdjustedTimers(pp *p, moved []*timer) {
|
|||||||
if s == timerModifiedEarlier {
|
if s == timerModifiedEarlier {
|
||||||
atomic.Xadd(&pp.adjustTimers, -1)
|
atomic.Xadd(&pp.adjustTimers, -1)
|
||||||
}
|
}
|
||||||
|
break loop
|
||||||
}
|
}
|
||||||
break loop
|
|
||||||
case timerNoStatus, timerRunning, timerRemoving, timerRemoved, timerMoving:
|
case timerNoStatus, timerRunning, timerRemoving, timerRemoved, timerMoving:
|
||||||
badTimer()
|
badTimer()
|
||||||
case timerModifying:
|
case timerModifying:
|
||||||
|
Loading…
Reference in New Issue
Block a user