Currently, the std.Io
interface isn't too optimizable:
- All forms of concurrent execution goes through
io.async/asynConcurrent(f)
andio.await
which can't be statically aware of when.await
will be called, so it must dynamically allocate the context needed to runf
. - The main api for blocking/unblocking on an arbitrary state is through Mutex & Condvar which require locking a mutex to wait (& wake correctly) + restrict implementors to only a
usize
with a biased representation for each state. - It ties cancellation to the task/concurrency model instead of to blocking operations (which are really the ones getting cancelled); To cancel a set of operations, they must be wrapped in a new spawned Future. It's also unclear, due to the racy nature of
io.cancel
, if a blocking operation consumes the stored cancellation request, or if it persists & causes all future blocking ops in that Future to return Cancelled.
I've thought of some ideas on how to address these + the all-encompassing nature of th