Update Waitable API.

Instead of passing the event mask at registratrion time, pass the mask as part
of the waiter. This makes the mask immutable and simplifies the architecture of
waiters. This is also necessary for a future fix that will allow the fdnotifier
to keep persistent entries, as opposed to requiring constant updates.

This change is intended to be a no-op in terms of function. The only exception
is signalfd, where this mask was abused. To handle this case, the operation of
signalfd changed to allow one layer of indirection.

PiperOrigin-RevId: 409702998
This commit is contained in:
Adin Scannell
2021-11-13 12:54:39 -08:00
committed by gVisor bot
parent 66fb6859d1
commit 91f58d2cc8
83 changed files with 534 additions and 532 deletions
+2 -2
View File
@@ -266,8 +266,8 @@ func (efd *EventFileDescription) Readiness(mask waiter.EventMask) waiter.EventMa
}
// EventRegister implements waiter.Waitable.EventRegister.
func (efd *EventFileDescription) EventRegister(entry *waiter.Entry, mask waiter.EventMask) {
efd.queue.EventRegister(entry, mask)
func (efd *EventFileDescription) EventRegister(entry *waiter.Entry) {
efd.queue.EventRegister(entry)
efd.mu.Lock()
defer efd.mu.Unlock()
+2 -2
View File
@@ -48,8 +48,8 @@ func TestEventFD(t *testing.T) {
defer eventfd.DecRef(ctx)
// Register a callback for a write event.
w, ch := waiter.NewChannelEntry(nil)
eventfd.EventRegister(&w, waiter.ReadableEvents)
w, ch := waiter.NewChannelEntry(waiter.ReadableEvents)
eventfd.EventRegister(&w)
defer eventfd.EventUnregister(&w)
data := []byte("00000124")