3 ms·
Async, and cooperative multitasking in general, requires all members participate in the contract: you shall not block and you shall not go too long until yield
by jnwatson 6y ago
Async, and cooperative multitasking in general, requires all members participate in the contract: you shall not block and you shall not go too long until yielding. Once a piece of code violates that, all bets are off. Python has explicit debugging mechanisms to help a developer detect the latter.
Cancel safety is less about killing an out-of-control task, and more about making sure the state after cancelling a task is consistent.
- jayd16 6y ago>you shall not block and you shall not go too long until yielding Eh... you as the caller have control on how a task is run. If you want it on a different thread and non-blocking, or simply deferred, you can. You have a lot of control. With an implicit system you have much less control. Loom seems to solve this by letting you explicitly schedule tasks anyhow?
- didibus 6y ago> you shall not block and you shall not go too long until yielding Arn't those effectively the same? I think the only contract is "you shall not go too long until yielding". Or if you're designing for performance, not for responsiveness, it might be: "you shall not hold unto CPU and IO resources that you're not using".