summaryrefslogtreecommitdiffhomepage
path: root/pkg/waiter/waiter.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-04-01 12:52:19 -0700
committerShentubot <shentubot@google.com>2019-04-01 12:53:27 -0700
commita4b34e26372528ef60140acef0b7c1ab1934f82a (patch)
tree3d308e07c065191dd0c4f0e30553eb21666c6969 /pkg/waiter/waiter.go
parent0327931ca41de892dcdae4fd6a7123cea5b0b2f0 (diff)
gvisor: convert ilist to ilist:generic_list
ilist:generic_list works faster (cl/240185278) and the code looks cleaner without type casting. PiperOrigin-RevId: 241381175 Change-Id: I8487ab1d73637b3e9733c253c56dce9e79f0d35f
Diffstat (limited to 'pkg/waiter/waiter.go')
-rw-r--r--pkg/waiter/waiter.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/pkg/waiter/waiter.go b/pkg/waiter/waiter.go
index 93390b299..fd429f733 100644
--- a/pkg/waiter/waiter.go
+++ b/pkg/waiter/waiter.go
@@ -59,8 +59,6 @@ package waiter
import (
"sync"
-
- "gvisor.googlesource.com/gvisor/pkg/ilist"
)
// EventMask represents io events as used in the poll() syscall.
@@ -127,7 +125,7 @@ type Entry struct {
// The following fields are protected by the queue lock.
mask EventMask
- ilist.Entry
+ waiterEntry
}
type channelCallback struct{}
@@ -162,7 +160,7 @@ func NewChannelEntry(c chan struct{}) (Entry, chan struct{}) {
//
// +stateify savable
type Queue struct {
- list ilist.List `state:"zerovalue"`
+ list waiterList `state:"zerovalue"`
mu sync.RWMutex `state:"nosave"`
}
@@ -186,8 +184,7 @@ func (q *Queue) EventUnregister(e *Entry) {
// in common with the notification mask.
func (q *Queue) Notify(mask EventMask) {
q.mu.RLock()
- for it := q.list.Front(); it != nil; it = it.Next() {
- e := it.(*Entry)
+ for e := q.list.Front(); e != nil; e = e.Next() {
if mask&e.mask != 0 {
e.Callback.Callback(e)
}
@@ -201,8 +198,7 @@ func (q *Queue) Events() EventMask {
ret := EventMask(0)
q.mu.RLock()
- for it := q.list.Front(); it != nil; it = it.Next() {
- e := it.(*Entry)
+ for e := q.list.Front(); e != nil; e = e.Next() {
ret |= e.mask
}
q.mu.RUnlock()