Skip to content

Commit f3fea27

Browse files
fvoznikagvisor-bot
authored andcommitted
Fix NeverReady to never be ready
Also removed AlwaysReady since no one uses it. PiperOrigin-RevId: 696311353
1 parent 4f92c28 commit f3fea27

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

pkg/waiter/waiter.go

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -259,45 +259,23 @@ func (q *Queue) IsEmpty() bool {
259259
return q.list.Front() == nil
260260
}
261261

262-
// AlwaysReady implements the Waitable interface but is always ready. Embedding
263-
// this struct into another struct makes it implement the boilerplate empty
264-
// functions automatically.
265-
type AlwaysReady struct {
266-
}
267-
268-
// Readiness always returns the input mask because this object is always ready.
269-
func (*AlwaysReady) Readiness(mask EventMask) EventMask {
270-
return mask
271-
}
272-
273-
// EventRegister doesn't do anything because this object doesn't need to issue
274-
// notifications because its readiness never changes.
275-
func (*AlwaysReady) EventRegister(*Entry) error {
276-
return nil
277-
}
278-
279-
// EventUnregister doesn't do anything because this object doesn't need to issue
280-
// notifications because its readiness never changes.
281-
func (*AlwaysReady) EventUnregister(e *Entry) {
282-
}
283-
284262
// NeverReady implements the Waitable interface but is never ready. Otherwise,
285263
// this is exactly the same as AlwaysReady.
286264
type NeverReady struct {
287265
}
288266

289-
// Readiness always returns the input mask because this object is always ready.
290-
func (*NeverReady) Readiness(mask EventMask) EventMask {
291-
return mask
267+
// Readiness always returns 0 because this object is never ready.
268+
func (*NeverReady) Readiness(EventMask) EventMask {
269+
return 0
292270
}
293271

294272
// EventRegister doesn't do anything because this object doesn't need to issue
295273
// notifications because its readiness never changes.
296-
func (*NeverReady) EventRegister(e *Entry) error {
274+
func (*NeverReady) EventRegister(*Entry) error {
297275
return nil
298276
}
299277

300278
// EventUnregister doesn't do anything because this object doesn't need to issue
301279
// notifications because its readiness never changes.
302-
func (*NeverReady) EventUnregister(e *Entry) {
280+
func (*NeverReady) EventUnregister(*Entry) {
303281
}

0 commit comments

Comments
 (0)