aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/binary/binary_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-03-09 13:36:58 -0500
committerGopher Robot <gobot@golang.org>2024-03-13 17:06:22 +0000
commit613565186792ecee69ed6d43e7290c6124e81f33 (patch)
tree7b024b074350454ecec1acfb3fb9f8d8e252b766 /src/encoding/binary/binary_test.go
parentb2e9221089f37400f309637b205f21af7dcb063b (diff)
downloadgo-613565186792ecee69ed6d43e7290c6124e81f33.tar.xz
runtime: clean up timer state
The timers had evolved to the point where the state was stored as follows: if timer in heap: state has timerHeaped set if heap timer is stale: heap deadline in t.when real deadline in t.nextWhen state has timerNextWhen set else: real deadline in t.when t.nextWhen unset else: real deadline in t.when t.nextWhen unset That made it hard to find the real deadline and just hard to think about everything. The new state is: real deadline in t.when (always) if timer in heap: state has timerHeaped set heap deadline in t.whenHeap if heap timer is stale: state has timerModified set Separately, the 'state' word itself was being used as a lock and state bits because the code started with CAS loops, which we abstracted into the lock/unlock methods step by step. At this point, we can switch to a real lock, making sure to publish the one boolean needed by timers fast paths at each unlock. All this simplifies various logic considerably. Change-Id: I35766204f7a26d999206bd56cc0db60ad1b17cbe Reviewed-on: https://go-review.googlesource.com/c/go/+/570335 Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/encoding/binary/binary_test.go')
0 files changed, 0 insertions, 0 deletions