是否可以禁用 YARV 的全局解释器锁?
这比其他任何事情都更令人好奇(我应该完全放弃它并尝试 jRuby),但是是否可以禁用 YARV ruby 的全局解释器锁和任何其他关联的锁?
我认为这会“使您的保证失效”,因为一些 YARV Ruby 的库不是线程安全的,但它会导致任何其他问题吗?
This is more curiosity than anything else (I should totally drop that and try jRuby), but is it possible to disable YARV ruby's global interpreter lock and any other associated locks?
I assume this would "void your warranty" as some of YARV Ruby's libraries aren't thread safe, but would it cause any other problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您实际编辑源代码并重新编译,否则无法禁用它。我还没有研究过它是如何实现的,但我猜想很难将它从代码中“弹出”。如果您不需要 GIL,您可以尝试 JRuby,我很确定 Rubinius 也没有 GIL。
There is no way to disable it unless you actually edit the source code and recompile. I haven't looked at how it's implemented, but I'm guessing it's hard to just "pop" it out of the code. If you don't want a GIL you could try JRuby, and I'm pretty sure Rubinius doesn't have one as well.
Tenderlove tweet 有关禁用 GIL 的补丁:
Tenderlove has tweeted about a patch to disable the GIL: