Doodle of polling system high-level API #3179
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a doodle of what the high-level API for the polling system might look like.
It bakes the concept straight into
Async
in kernel. This goes to the point that you need anIO
-like ecosystem to really take advantage of this, but enables the ecosystem to build without knowing aboutIO
.It enforces the idea that the
PollingSystem
you want might not be available. This may happen for various reasons:evalOn
-ed off of itThis gives implementations the chance to recover, which in practice would mean starting and using their own event-loop thread. It also lets an easy default implementation fall out.
It encourages you to do everything you need with the
PollingSystem
in a single, atomicdelay
block. Because a subsequent effect can always execute on another thread (since we do not have anuncedable
construct) this is the only safe way to interact with aPollingSystem
without requiring it to be threadsafe.Example use
These are rough sketches, but whatever.
Selector
io_uring