diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-07-13 00:24:39 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-13 00:24:39 +0000 |
commit | d1eb28b4e318c9efab490ddb268bebfec787d6b9 (patch) | |
tree | 12b9d2a3ba8446496a4dc928c26bc17c0e7b870e /pkg/sleep | |
parent | 4d77d43d8d1194f05e72db3d361ecdb93fac0296 (diff) | |
parent | 9c32fd3f4d8f6e63d922c1c58b7d1f1f504fa2bc (diff) |
Merge release-20200622.1-92-g9c32fd3f4 (automated)
Diffstat (limited to 'pkg/sleep')
-rw-r--r-- | pkg/sleep/sleep_unsafe.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sleep/sleep_unsafe.go b/pkg/sleep/sleep_unsafe.go index f68c12620..118805492 100644 --- a/pkg/sleep/sleep_unsafe.go +++ b/pkg/sleep/sleep_unsafe.go @@ -75,6 +75,8 @@ package sleep import ( "sync/atomic" "unsafe" + + "gvisor.dev/gvisor/pkg/sync" ) const ( @@ -323,7 +325,12 @@ func (s *Sleeper) enqueueAssertedWaker(w *Waker) { // // This struct is thread-safe, that is, its methods can be called concurrently // by multiple goroutines. +// +// Note, it is not safe to copy a Waker as its fields are modified by value +// (the pointer fields are individually modified with atomic operations). type Waker struct { + _ sync.NoCopy + // s is the sleeper that this waker can wake up. Only one sleeper at a // time is allowed. This field can have three classes of values: // nil -- the waker is not asserted: it either is not associated with |