diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-12-03 14:26:57 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-12-03 14:26:57 +0000 |
commit | b90360c0c293247f6e755e937ef518c1a9e0d2df (patch) | |
tree | 270a799d3b616e8648be3c22db446eb7ab9ee51c /pkg/waiter | |
parent | 194d07eeb5e3f0708fbfe4afd0d4d7dadd364863 (diff) | |
parent | 6f60a2b0a27a742690aa6acd5df1912ccb5fc8d3 (diff) |
Merge release-20201130.0-30-g6f60a2b0a (automated)
Diffstat (limited to 'pkg/waiter')
-rw-r--r-- | pkg/waiter/waiter.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/waiter/waiter.go b/pkg/waiter/waiter.go index 08519d986..83d4f893a 100644 --- a/pkg/waiter/waiter.go +++ b/pkg/waiter/waiter.go @@ -119,7 +119,10 @@ type EntryCallback interface { // The callback is supposed to perform minimal work, and cannot call // any method on the queue itself because it will be locked while the // callback is running. - Callback(e *Entry) + // + // The mask indicates the events that occurred and that the entry is + // interested in. + Callback(e *Entry, mask EventMask) } // Entry represents a waiter that can be add to the a wait queue. It can @@ -140,7 +143,7 @@ type channelCallback struct { } // Callback implements EntryCallback.Callback. -func (c *channelCallback) Callback(*Entry) { +func (c *channelCallback) Callback(*Entry, EventMask) { select { case c.ch <- struct{}{}: default: @@ -193,8 +196,8 @@ func (q *Queue) EventUnregister(e *Entry) { func (q *Queue) Notify(mask EventMask) { q.mu.RLock() for e := q.list.Front(); e != nil; e = e.Next() { - if mask&e.mask != 0 { - e.Callback.Callback(e) + if m := mask & e.mask; m != 0 { + e.Callback.Callback(e, m) } } q.mu.RUnlock() |