Ruby 请问在 MRI 中,为何会用到 pthread 线程库?

lilijreey · July 05, 2016 · Last by lilijreey replied at July 05, 2016 · 1348 hits

今天没事看了下 Ruby2.2 的源码,mian 函数一开始就来了一个 ruby_init_stack, 里面看到有 pthread 库的函数, thread_pthrea.c 中居然还有 native_thread_createo 这种创建本地线程的函数,不过并没有用

我的理解 MRI 中并没有 native 的线程,为何会使用,请各位大侠不吝赐教

1.9 之后 MRI 有用 native thread 的,只是因为有 GIL 的存在不能用多核

而且我记得 ruby 启动之后并不是一个线程,是有两个线程的,忘记另一个线程是干嘛的了。

#2 楼 @nowherekai Thanks 我在看看

You need to Sign in before reply, if you don't have an account, please Sign up first.