concurrency
concurrency copied to clipboard
why does syncWait.assumeOk throw when calling onDone?
https://github.com/symmetryinvestments/concurrency/blob/7dd10addd320f908e62300bcef2702b9de9ac4a3/tests/ut/concurrency/sender.d#L21
I don't get why this test code passes - DoneSender should just make the task finish without value, while ThrowingSender makes it error/abort.
Why does the test check for assumeOk.shouldThrow throw like ThrowingSender?
Yeah, I am on the fence here.
With Senders there are 3 termination points: natural completion, completion due to cancellation and error. assumeOk only counts natural completion as correct, and errors out on the other 2.
DoneSender is a bit of a misnomer I guess, CancelSender would have been a bit better.
onDone should probably also be called onCancel then I think?
onDone should probably also be called onCancel then I think?
Its actually called setDone. Emphasize on completion.
One thing about cancellation is that in terms of lifecycle its important to know when the cancellation is done. Its only when it is done that resources can be cleaned.
Senders signal completion, so the setValue, setDone, setError trifecta actually makes sense. And contrary to what I said yesterday, that makes DoneSender actually the more correct naming.
Sorry, the concurrency stuff has moved to the back of my mind a bit.