* 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(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
57ed1e9d75
commit
afd1a64cd6
@ -1,3 +1,10 @@
|
|||||||
|
Mon Jun 13 23:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Mon Jun 13 23:50:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* ext/io/console/console.c (console_dev): typo.
|
* ext/io/console/console.c (console_dev): typo.
|
||||||
|
10
thread.c
10
thread.c
@ -1025,18 +1025,8 @@ rb_thread_schedule_rec(int sched_depth, unsigned long limits_us)
|
|||||||
|
|
||||||
RB_GC_SAVE_MACHINE_CONTEXT(th);
|
RB_GC_SAVE_MACHINE_CONTEXT(th);
|
||||||
|
|
||||||
#if HAVE_GVL_YIELD
|
|
||||||
{
|
|
||||||
if (th->running_time_us >= limits_us)
|
if (th->running_time_us >= limits_us)
|
||||||
gvl_yield(th->vm, th);
|
gvl_yield(th->vm, th);
|
||||||
}
|
|
||||||
#else
|
|
||||||
gvl_release(th->vm);
|
|
||||||
{
|
|
||||||
native_thread_yield();
|
|
||||||
}
|
|
||||||
gvl_acquire(th->vm, th);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rb_thread_set_current(th);
|
rb_thread_set_current(th);
|
||||||
thread_debug("rb_thread_schedule/switch done\n");
|
thread_debug("rb_thread_schedule/switch done\n");
|
||||||
|
@ -83,7 +83,6 @@ gvl_release(rb_vm_t *vm)
|
|||||||
native_mutex_unlock(&vm->gvl.lock);
|
native_mutex_unlock(&vm->gvl.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HAVE_GVL_YIELD 1
|
|
||||||
static void
|
static void
|
||||||
gvl_yield(rb_vm_t *vm, rb_thread_t *th)
|
gvl_yield(rb_vm_t *vm, rb_thread_t *th)
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,15 @@ gvl_release(rb_vm_t *vm)
|
|||||||
ReleaseMutex(vm->gvl.lock);
|
ReleaseMutex(vm->gvl.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
gvl_atfork(rb_vm_t *vm)
|
gvl_atfork(rb_vm_t *vm)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user