1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* thread_pthread.c (gvl_release, gvl_init): suppress warnings.

* vm_core.h (rb_vm_gvl_destroy): add prototype.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-11-28 05:48:31 +00:00
parent 079545cd8c
commit 925da00b02
3 changed files with 12 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Sun Nov 28 14:48:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread_pthread.c (gvl_release, gvl_init): suppress warnings.
* vm_core.h (rb_vm_gvl_destroy): add prototype.
Sun Nov 28 14:46:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread_pthread.c (gvl_reinit): register atfork hander only in
@ -15,7 +21,7 @@ Sun Nov 28 12:23:57 2010 Koichi Sasada <ko1@atdot.net>
this causes some issues such as priority inversion and so on.)
This impl. prevents spin-loop (*1) caused on SMP environemnts.
*1: Only one Ruby thread acqures GVL again and again.
Bug #2359 [ruby-core:26694]
Bug #2359 [ruby-core:26694]
* thread_win32.c, thread_win32.h: Using simple lock
not by CRITICAL_SECTION but by Mutex.

View file

@ -29,7 +29,7 @@ static void native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
static void native_cond_initialize(pthread_cond_t *cond);
static void native_cond_destroy(pthread_cond_t *cond);
static void native_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
static void native_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
#define native_mutex_reinitialize_atfork(lock) (\
native_mutex_unlock(lock), \
@ -50,6 +50,7 @@ gvl_show_waiting_threads(rb_vm_t *vm)
}
}
#if !GVL_SIMPLE_LOCK
static void
gvl_waiting_push(rb_vm_t *vm, rb_thread_t *th)
{
@ -73,6 +74,7 @@ gvl_waiting_shift(rb_vm_t *vm, rb_thread_t *th)
vm->gvl.waiting_threads = vm->gvl.waiting_threads->native_thread_data.gvl_next;
vm->gvl.waiting--;
}
#endif
static void
gvl_acquire(rb_vm_t *vm, rb_thread_t *th)
@ -114,7 +116,7 @@ gvl_release(rb_vm_t *vm)
native_cond_signal(&th->native_thread_data.gvl_cond);
}
else {
if (GVL_DEBUG) fprintf(stderr, "gvl release (%p): wakeup: %p\n", GET_THREAD(), 0);
if (GVL_DEBUG) fprintf(stderr, "gvl release (%p): wakeup: %p\n", GET_THREAD(), NULL);
/* do nothing */
}
vm->gvl.acquired = 0;

View file

@ -639,6 +639,7 @@ VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
int argc, const VALUE *argv, const rb_block_t *blockptr);
VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
void rb_vm_gvl_destroy(rb_vm_t *vm);
void rb_thread_start_timer_thread(void);
void rb_thread_stop_timer_thread(void);