-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expose scheduler as public interface & bug fixes. #3945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
By the way, I don't like all source files being in root directory. So this is the first step to improve the situation. I will also move coroutine implementation. |
073c125 to
4d2869c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why under "source/" too.
It doesn't feel nice to move just one file, but just confusing.
@ko1 "source/" differs from the srcdir, I think.
|
I am happy to move all files to source directory but it feels out of scope for this PR. So I just want to try with one file. If it’s too hard we can certainly just use the same structure as before. |
4d2869c to
bddfd84
Compare
|
I gave up trying to make windows build work with nested source path. |
bddfd84 to
06b0528
Compare
Agreed.
It is not good to mix a part of out-of-scope change into a different PR. |
73cef15 to
bed9c02
Compare
|
@nobu is it easier just to use in |
|
As 3.0 has been released with
|
|
As @nobu said, The C interface should be exposed because C extensions need it. I'd prefer if we don't spread all those hooks across different extensions using |
1fb0067 to
2677bbd
Compare
|
@ko1 said:
I don't advise this because user should prefer @eregon I thought about it and I don't see why we should hide this C interface, it seems arbitrary and makes maintenance more burdensome. Another option is to have two headers, one for internal and one for C extensions, but it seems super arbitrary, so I'm against any changes/limitations in this regard and am happy with this PR. |
bdc084f to
bfc61b5
Compare
|
|
||
| VALUE | ||
| rb_scheduler_kernel_sleepv(VALUE scheduler, int argc, VALUE * argv) | ||
| rb_fiber_scheduler_kernel_sleepv(VALUE scheduler, int argc, VALUE * argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kernel#sleep always take a single argument, is there any reason to expose this variadic variant, in addition to the one above?
No they don't need it, the only thing that probably needs to be exposed for convenience/efficiency is rb_fiber_scheduler_current(). If the number of arguments are changed for the scheduler, it's going to break compatibility with existing schedulers anyway. In fact I'd argue it's less flexible because it slows down scheduler API evolution, i.e., with these new C APIs, C extensions will probably consider they can only use exposed functions, but if it was all rb_check_funcall() then C extensions/gems could just check if the scheduler supports a given hook, regardless of the Ruby version, which seems more flexible. Anyway, if you really want to add these new C APIs I don't strongly object (although I think it's not worth it and I think it's less flexible), but then please write specs or tests for it. |
I see this as an advantage in terms of stability which is pretty important. If we have extensions making their own decisions about data types etc it could be a nightmare to support/test.
Ok. |
bfc61b5 to
35d93d5
Compare
|
I understand there is some contention around exposing C interface. I do understand both sides. However, I'd like to keep this PR a bit simple in terms of "public interface" for scheduler is exposed. If we decided it is too much, we can revert before 3.1 is released. |
Because
socketis an extension to Ruby, we need to expose the scheduler interface to implement https://bugs.ruby-lang.org/issues/17370