Issue #2103 has been updated by Aman Gupta.


The initial patch actually breaks the thread timer for the normal case, since rb_thread_start_timer() is called before the new thread is added to the doubly linked list.

diff --git a/eval.c b/eval.c
index f503cf6..9aad3d9 100644
--- a/eval.c
+++ b/eval.c
@@ -12608,6 +12608,9 @@ thread_insert(th)
        curr_thread->next = th;
        th->priority = curr_thread->priority;
        th->thgroup = curr_thread->thgroup;
+#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
+       rb_thread_start_timer();
+#endif
     }
 }
 
@@ -12628,12 +12631,6 @@ rb_thread_start_0(fn, arg, th)
                 "can't start a new thread (frozen ThreadGroup)");
     }
 
-#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
-    if (!thread_init) {
-       rb_thread_start_timer();
-    }
-#endif
-
     if (THREAD_SAVE_CONTEXT(curr_thread)) {
        return thread;
     }
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2103

----------------------------------------
http://redmine.ruby-lang.org