Open machty opened 2 years ago
cc @ioquatix
This is the first time I've done work on a C extension, not to mention working with the native Fiber scheduler API, so I welcome any feedback. I've already added a few comments; curious as to your thoughts on whether some of the io_from_fd
copypasta can be removed.
I see so we are missing an interface to wrap a native FD into a Ruby IO at the extension level?
This implements support for the Ruby 3.0+ Fiber Scheduler interface.
If a Fiber Scheduler (such as the one defined by the Async library) is present, then we invoke its hooks whenever we're about to perform an IO wait operation. This makes it possible for the scheduler to pass control to another Fiber/task while waiting for the socket to become readable/writable.
Closes #76
Example
Ruby 3.1 + Async 2.0.0:
This outputs:
Without this PR, the output is just the following (it just hangs):
TODO: