Skip to content
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

How to release the GVL? #129

Open
KMarshland opened this issue Jan 8, 2025 · 2 comments
Open

How to release the GVL? #129

KMarshland opened this issue Jan 8, 2025 · 2 comments

Comments

@KMarshland
Copy link

KMarshland commented Jan 8, 2025

Is there a way to release the GVL/GIL? I saw in #12 that it wasn't in Magnus yet, but that was 2.5 years ago.

For reference, my use case is doing some extremely CPU intensive processing based on a filename, so no need to go back and forth with ruby objects. In principle I could handle this via a popen3 to a binary, but I quite like the ergonomics of using Magnus.

@KMarshland KMarshland changed the title How to release the GIL? How to release the GVL? Jan 8, 2025
@matsadler
Copy link
Owner

Magnus' original API wasn't compatible with (safely) implementing a function to release the GVL. It's been a slow process designing and then migrating functions from the old api design to one that will be able to support a safe implementation of releasing the GVL, so as yet there isn't the functionality built in to Magnus.

It is possible to implement it yourself via rb-sys, and I think if you do a web search you'll find a couple of people who have done this.

@KMarshland
Copy link
Author

Thanks! As you said "as yet", I take it that it's in the roadmap? Awesome to hear (and thank you for your hard work on this library).

For others coming across this thread, the main thing I found here was https://github.com/Maaarcocr/lucchetto, though I don't use it myself (opting instead for spawning new processes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants