-
Notifications
You must be signed in to change notification settings - Fork 69
New without_gvl() and with_gvl() functions to release/acquire the GVL #313
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
d686a53
to
1f63bed
Compare
Co-authored-by: Ates Goral <[email protected]>
1f63bed
to
941eed6
Compare
Hi @tavianator - thanks for working on this. I did have something different in mind though. When using
So introduce a third allowed class, Internally Rice would release the GIL before calling the c++ function/method. Any number of method parameters should be supported, so it would work similarly to Another approach could be what pyBind`` does - it has a more generic mechanism that allows users to specify a guard Class that is passed to As for calling back to Ruby and having to get the GIL, I would probably say that is the implementor's problem. As for specifying a UBF function, I would probably not support that and just use Ruby's default one. |
Ah okay I'll give that a try. However I don't think that API would work for the use case that prompted this in the first place, since we have to check |
Good point. Then we probably do need a lower level class similar to IE |
I don't see how to build a |
Agreed. The generic implementation of manually calling a C++ function without the GIL would be very similar to
So 2 classes, |
Well that turned out to be a lot harder than I thought it would. Anyway, this functionality is now implemented (see the linked commit). I still need to update the docs to describe how it works. Thanks for the help on this @tavianator |
No problem, thanks for taking it to the finish line! |
As requested in ankane/faiss-ruby#7 (comment)