mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix NeverReady to never be ready
Also removed AlwaysReady since no one uses it. PiperOrigin-RevId: 696590677
This commit is contained in:
committed by
gVisor bot
parent
88d8a78243
commit
7238487fac
+5
-27
@@ -259,45 +259,23 @@ func (q *Queue) IsEmpty() bool {
|
||||
return q.list.Front() == nil
|
||||
}
|
||||
|
||||
// AlwaysReady implements the Waitable interface but is always ready. Embedding
|
||||
// this struct into another struct makes it implement the boilerplate empty
|
||||
// functions automatically.
|
||||
type AlwaysReady struct {
|
||||
}
|
||||
|
||||
// Readiness always returns the input mask because this object is always ready.
|
||||
func (*AlwaysReady) Readiness(mask EventMask) EventMask {
|
||||
return mask
|
||||
}
|
||||
|
||||
// EventRegister doesn't do anything because this object doesn't need to issue
|
||||
// notifications because its readiness never changes.
|
||||
func (*AlwaysReady) EventRegister(*Entry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventUnregister doesn't do anything because this object doesn't need to issue
|
||||
// notifications because its readiness never changes.
|
||||
func (*AlwaysReady) EventUnregister(e *Entry) {
|
||||
}
|
||||
|
||||
// NeverReady implements the Waitable interface but is never ready. Otherwise,
|
||||
// this is exactly the same as AlwaysReady.
|
||||
type NeverReady struct {
|
||||
}
|
||||
|
||||
// Readiness always returns the input mask because this object is always ready.
|
||||
func (*NeverReady) Readiness(mask EventMask) EventMask {
|
||||
return mask
|
||||
// Readiness always returns 0 because this object is never ready.
|
||||
func (*NeverReady) Readiness(EventMask) EventMask {
|
||||
return 0
|
||||
}
|
||||
|
||||
// EventRegister doesn't do anything because this object doesn't need to issue
|
||||
// notifications because its readiness never changes.
|
||||
func (*NeverReady) EventRegister(e *Entry) error {
|
||||
func (*NeverReady) EventRegister(*Entry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventUnregister doesn't do anything because this object doesn't need to issue
|
||||
// notifications because its readiness never changes.
|
||||
func (*NeverReady) EventUnregister(e *Entry) {
|
||||
func (*NeverReady) EventUnregister(*Entry) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user