ruby-changes:20022
From: kosaki <ko1@a...>
Date: Tue, 14 Jun 2011 00:06:37 +0900 (JST)
Subject: [ruby-changes:20022] kosaki:r32069 (trunk): * thread.c (rb_thread_schedule_rec): call gvl_yield() unconditionally.
kosaki 2011-06-14 00:06:30 +0900 (Tue, 14 Jun 2011) New Revision: 32069 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32069 Log: * thread.c (rb_thread_schedule_rec): call gvl_yield() unconditionally. * thread_pthread.c: remove HAVE_GVL_YIELD macro. * thread_win32.c (gvl_yield): new. this fallback logic was moved from rb_thread_schedule_rec(). Modified files: trunk/ChangeLog trunk/thread.c trunk/thread_pthread.c trunk/thread_win32.c Index: thread_win32.c =================================================================== --- thread_win32.c (revision 32068) +++ thread_win32.c (revision 32069) @@ -106,6 +106,15 @@ } static void +gvl_yield(rb_vm_t *vm, rb_thread_t *th) +{ + gvl_release(th->vm); + native_thread_yield(); + gvl_acquire(vm, th); +} + + +static void gvl_atfork(rb_vm_t *vm) { rb_bug("gvl_atfork() is called on win32"); Index: ChangeLog =================================================================== --- ChangeLog (revision 32068) +++ ChangeLog (revision 32069) @@ -1,3 +1,10 @@ +Mon Jun 13 23:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * thread.c (rb_thread_schedule_rec): call gvl_yield() unconditionally. + * thread_pthread.c: remove HAVE_GVL_YIELD macro. + * thread_win32.c (gvl_yield): new. this fallback logic was moved from + rb_thread_schedule_rec(). + Mon Jun 13 23:50:25 2011 NAKAMURA Usaku <usa@r...> * ext/io/console/console.c (console_dev): typo. Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 32068) +++ thread_pthread.c (revision 32069) @@ -83,7 +83,6 @@ native_mutex_unlock(&vm->gvl.lock); } -#define HAVE_GVL_YIELD 1 static void gvl_yield(rb_vm_t *vm, rb_thread_t *th) { Index: thread.c =================================================================== --- thread.c (revision 32068) +++ thread.c (revision 32069) @@ -1025,18 +1025,8 @@ RB_GC_SAVE_MACHINE_CONTEXT(th); -#if HAVE_GVL_YIELD - { - if (th->running_time_us >= limits_us) - gvl_yield(th->vm, th); - } -#else - gvl_release(th->vm); - { - native_thread_yield(); - } - gvl_acquire(th->vm, th); -#endif + if (th->running_time_us >= limits_us) + gvl_yield(th->vm, th); rb_thread_set_current(th); thread_debug("rb_thread_schedule/switch done\n"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/