3 ms·
Very cool. Would love to see it be Ractor-safe too, which C extensions are not by default. https://docs.ruby-lang.org/en/master/extension_rdoc.html#label-Appen
by Lammy 2y ago
Very cool. Would love to see it be Ractor-safe too, which C extensions are not by default.
https://docs.ruby-lang.org/en/master/extension_rdoc.html#label-Appendix+F.+Ractor+support https://docs.ruby-lang.org/en/master/extension_rdoc.html#lab... sez:
“Ractor safety around C extensions has the following properties:
— By default, all C extensions are recognized as Ractor-unsafe.
— Ractor-unsafe C-methods may only be called from the main Ractor. If invoked by a non-main Ractor, then a Ractor::UnsafeError is raised.
— If an extension desires to be marked as Ractor-safe the extension should call rb_ext_ractor_safe(true) at the Init_ function for the extension, and all defined methods will be marked as Ractor-safe.”
I don't know enough about io_uring to know if there would be any thread-safety issues to just declaring it, but here's an example pull request from a few years ago enabling Ractor support on a C extension that had no sharing issues: https://github.com/dearblue/ruby-extattr/pull/1/ https://github.com/dearblue/ruby-extattr/pull/1/
- ciconia 2y agoThanks, that should be possible. I'll put it on the project's TODO list :-).