[ruby-cvs:70163] ko1:r63073 (trunk): Fix Fiber with Thread issue on Windows [Bug #14642]

ko1 at ruby-lang.org ko1 at ruby-lang.org
Tue Apr 3 19:21:47 JST 2018

ko1	2018-04-03 19:21:47 +0900 (Tue, 03 Apr 2018)

  New Revision: 63073


    Fix Fiber with Thread issue on Windows [Bug #14642]
    * cont.c (rb_threadptr_root_fiber_setup): divide into two functions:
      * rb_threadptr_root_fiber_setup_by_parent(): called by the parent thread.
      * rb_threadptr_root_fiber_setup_by_child(): called by the created thread.
      `rb_threadptr_root_fiber_setup()` is called by the parent thread and
      set fib->fib_handle by ConvertThreadToFiber() on the parent thread on
      Windows enveironment.
      This means that root_fib->fib_handle of child thread is initialized
      with parent thread's Fiber handle. Furthermore, second call of
      `ConvertThreadToFiber()` for the same thread fails.
      This patch solves this weird situateion. However, maybe we can make more
      clean code.
    * thread.c (thread_start_func_2): call
      `rb_threadptr_root_fiber_setup_by_child()` at thread initialize routine.
    * vm.c (th_init): call `rb_threadptr_root_fiber_setup_by_parent()`.

  Modified files:

More information about the ruby-cvs mailing list