Scheduler#3434
Conversation
|
Some notes about The most efficient (zero-copy) interface for This is different from existing Ruby implementation which uses However, in practice both interfaces are critical. For example, So, we need to support both for high performance I/O. Therefore, I introduced new optional |
| #define GetOpenFile RB_IO_POINTER | ||
|
|
||
| #define MakeOpenFile(obj, fp) do {\ | ||
| #define RB_IO_OPEN(obj, fp) do {\ |
|
@eregon I have merged your changes into this branch because I want to build on them. Thanks for your effort. |
63c453b to
693d725
Compare
|
@jeremyevans do you believe this code is sufficient for your Sequel pool management? |
|
I believe Fiber-aware Mutex is a necessary condition for Sequel connection pool management to work correctly with multiple concurrent fibers of the same thread. I'm not sure if ConditionalVariable also needs to be Fiber-aware or not. So I'm not sure if this will be sufficient by itself, but it is definitely a step in the right direction. |
|
|
|
I need to check in and a few others - some are public interface and should go via the same |
| if (w < 0) rb_eof_error(); | ||
| if (!(w & RB_WAITFD_IN)) return Qnil; | ||
| VALUE result = RB_NUM2INT(rb_io_wait(io, RUBY_IO_READABLE, timeout)); | ||
| if (result == Qfalse) return Qnil; |
aea7f4d to
2a50788
Compare
* Enables Mutex to be used as synchronization between multiple Fibers of the same Thread. * With a Fiber scheduler we can yield to another Fiber on contended Mutex#lock instead of blocking the entire thread. * This also makes the behavior of Mutex consistent across CRuby, JRuby and TruffleRuby. * [Feature ruby#16792]
This is a work in progress.
Fiber{}toFiber.schedule{}.class_method, e.g.io_waitorkernel_sleep.wait.cto passIOinstance, and other adjustments where possible.io_readas a hook for implementing io_uring (Linux) and IOCP (Windows).