summaryrefslogtreecommitdiffhomepage
path: root/pkg/waiter
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-06-24 20:59:20 +0000
committergVisor bot <gvisor-bot@google.com>2020-06-24 20:59:20 +0000
commit0671d5e343392ec8d40f714c0becc50ad46e0afa (patch)
tree69dc5bf3ecd3c3378196c0cbfcfdaea9d0126cd1 /pkg/waiter
parent0df6689b497c35af683af8f7b2380f8803640adb (diff)
parent10930b0f8c1ff2ac83c7a30cc1f78112a35e3183 (diff)
Merge release-20200608.0-121-g10930b0f8 (automated)
Diffstat (limited to 'pkg/waiter')
-rw-r--r--pkg/waiter/waiter.go18
-rw-r--r--pkg/waiter/waiter_state_autogen.go15
2 files changed, 12 insertions, 21 deletions
diff --git a/pkg/waiter/waiter.go b/pkg/waiter/waiter.go
index 707eb085b..67a950444 100644
--- a/pkg/waiter/waiter.go
+++ b/pkg/waiter/waiter.go
@@ -128,13 +128,6 @@ type EntryCallback interface {
//
// +stateify savable
type Entry struct {
- // Context stores any state the waiter may wish to store in the entry
- // itself, which may be used at wake up time.
- //
- // Note that use of this field is optional and state may alternatively be
- // stored in the callback itself.
- Context interface{}
-
Callback EntryCallback
// The following fields are protected by the queue lock.
@@ -142,13 +135,14 @@ type Entry struct {
waiterEntry
}
-type channelCallback struct{}
+type channelCallback struct {
+ ch chan struct{}
+}
// Callback implements EntryCallback.Callback.
-func (*channelCallback) Callback(e *Entry) {
- ch := e.Context.(chan struct{})
+func (c *channelCallback) Callback(*Entry) {
select {
- case ch <- struct{}{}:
+ case c.ch <- struct{}{}:
default:
}
}
@@ -164,7 +158,7 @@ func NewChannelEntry(c chan struct{}) (Entry, chan struct{}) {
c = make(chan struct{}, 1)
}
- return Entry{Context: c, Callback: &channelCallback{}}, c
+ return Entry{Callback: &channelCallback{ch: c}}, c
}
// Queue represents the wait queue where waiters can be added and
diff --git a/pkg/waiter/waiter_state_autogen.go b/pkg/waiter/waiter_state_autogen.go
index 086f10dbc..2a2321a67 100644
--- a/pkg/waiter/waiter_state_autogen.go
+++ b/pkg/waiter/waiter_state_autogen.go
@@ -12,7 +12,6 @@ func (x *Entry) StateTypeName() string {
func (x *Entry) StateFields() []string {
return []string{
- "Context",
"Callback",
"mask",
"waiterEntry",
@@ -23,19 +22,17 @@ func (x *Entry) beforeSave() {}
func (x *Entry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save(0, &x.Context)
- m.Save(1, &x.Callback)
- m.Save(2, &x.mask)
- m.Save(3, &x.waiterEntry)
+ m.Save(0, &x.Callback)
+ m.Save(1, &x.mask)
+ m.Save(2, &x.waiterEntry)
}
func (x *Entry) afterLoad() {}
func (x *Entry) StateLoad(m state.Source) {
- m.Load(0, &x.Context)
- m.Load(1, &x.Callback)
- m.Load(2, &x.mask)
- m.Load(3, &x.waiterEntry)
+ m.Load(0, &x.Callback)
+ m.Load(1, &x.mask)
+ m.Load(2, &x.waiterEntry)
}
func (x *Queue) StateTypeName() string {