зеркало из https://github.com/github/ruby.git
* thread_pthread.c (thread_start_func_1): initialize native thread
data immediately before starting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bc8b100873
Коммит
16d4733ee4
|
@ -1,3 +1,8 @@
|
|||
Sun Nov 28 21:46:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* thread_pthread.c (thread_start_func_1): initialize native thread
|
||||
data immediately before starting.
|
||||
|
||||
Sun Nov 28 14:56:32 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (struct argf): make lineno long, and reorder members.
|
||||
|
|
|
@ -324,6 +324,8 @@ ruby_thread_set_native(rb_thread_t *th)
|
|||
return pthread_setspecific(ruby_native_thread_key, th) == 0;
|
||||
}
|
||||
|
||||
static void native_thread_init(rb_thread_t *th);
|
||||
|
||||
void
|
||||
Init_native_thread(void)
|
||||
{
|
||||
|
@ -331,11 +333,17 @@ Init_native_thread(void)
|
|||
|
||||
pthread_key_create(&ruby_native_thread_key, NULL);
|
||||
th->thread_id = pthread_self();
|
||||
native_thread_init(th);
|
||||
native_mutex_initialize(&signal_thread_list_lock);
|
||||
posix_signal(SIGVTALRM, null_func);
|
||||
}
|
||||
|
||||
static void
|
||||
native_thread_init(rb_thread_t *th)
|
||||
{
|
||||
native_cond_initialize(&th->native_thread_data.sleep_cond);
|
||||
native_cond_initialize(&th->native_thread_data.gvl_cond);
|
||||
ruby_thread_set_native(th);
|
||||
native_mutex_initialize(&signal_thread_list_lock);
|
||||
posix_signal(SIGVTALRM, null_func);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -519,6 +527,7 @@ thread_start_func_1(void *th_ptr)
|
|||
#ifndef __CYGWIN__
|
||||
native_thread_init_stack(th);
|
||||
#endif
|
||||
native_thread_init(th);
|
||||
/* run */
|
||||
thread_start_func_2(th, &stack_start, rb_ia64_bsp());
|
||||
}
|
||||
|
@ -679,10 +688,6 @@ native_thread_create(rb_thread_t *th)
|
|||
err = pthread_create(&th->thread_id, &attr, thread_start_func_1, th);
|
||||
thread_debug("create: %p (%d)", (void *)th, err);
|
||||
CHECK_ERR(pthread_attr_destroy(&attr));
|
||||
|
||||
if (!err) {
|
||||
pthread_cond_init(&th->native_thread_data.sleep_cond, 0);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче