diff options
| author | Russ Cox <rsc@golang.org> | 2024-02-29 18:03:23 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2024-03-09 03:40:04 +0000 |
| commit | bc20704c265be3c5c6696dd703202ecef9b31d4f (patch) | |
| tree | 02327ff2bf5df69209eabbad9330d39080a32912 /src/runtime/export_test.go | |
| parent | 07b4fee5810005357ba64d2934de90dee244f51d (diff) | |
| download | go-bc20704c265be3c5c6696dd703202ecef9b31d4f.tar.xz | |
time: move runtimeTimer out of Timer struct
If user code has two timers t1 and t2 and does *t1 = *t2
(or *t1 = Timer{}), it creeps me out that we would be
corrupting the runtime data structures inlined in the
Timer struct. Replace that field with a pointer to the
runtime data structure instead, so that the corruption
cannot happen, even in a badly behaved program.
In fact, remove the struct definition entirely and linkname
a constructor instead. Now the runtime can evolve the struct
however it likes without needing to keep package time in sync.
Also move the workaround logic for #21874 out of
runtime and into package time.
Change-Id: Ia30f7802ee7b3a11f5d8a78dd30fd9c8633dc787
Reviewed-on: https://go-review.googlesource.com/c/go/+/568339
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 9b84e96e50..fe79497e7f 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -63,6 +63,8 @@ var MapValues = values var LockPartialOrder = lockPartialOrder +type TimeTimer = timeTimer + type LockRank lockRank func (l LockRank) String() string { |
