capnproto
capnproto copied to clipboard
Why does WaiterQueue::fulfill require the queue to be empty?
I'd like to make two changes to the WaiterQueue
class, but I'd like some feedback first.
-
WaiterQueue::fulfill
andWaiterQueue::reject
require the queue to be non-empty. I'm not sure I understand the meaning of this. To me it seems pretty natural that if you callfulfill
, and nobody is waiting for that value, the value is simply discarded. How can the producer ensure that there are consumers ready before pushing a value? - If
WaiterQueue
is destroyed and there are outstanding waiters, those waiters will be left hanging. AFAIK this is different from the behavior of Promise/Fulfiller pairs. If a Fulfiller is destroyed and its Promise still exists, the Promise should be rejected.