diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 08:40:13 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 08:40:13 +0000 |
commit | 6fc746d7e32243b4c46ac5ef9fee4806664fd7e6 (patch) | |
tree | 966dc305bfddb1b740f825806de4720d8e720825 /thread_pthread.ci | |
parent | 2c5ae0eebad1397653f5dac5982cd5eba14ff35d (diff) | |
download | ruby-6fc746d7e32243b4c46ac5ef9fee4806664fd7e6.tar.gz |
* thread.c (is_ruby_native_thread): check properly. [ruby-dev:31166]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.ci')
-rw-r--r-- | thread_pthread.ci | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/thread_pthread.ci b/thread_pthread.ci index d624e98487..b8b609145e 100644 --- a/thread_pthread.ci +++ b/thread_pthread.ci @@ -72,16 +72,34 @@ static void remove_signal_thread_list(rb_thread_t *th); static rb_thread_lock_t signal_thread_list_lock; +static pthread_key_t ruby_native_thread_key; + static void null_func() { /* null */ } +static rb_thread_t * +ruby_thread_from_native(void) +{ + return pthread_getspecific(ruby_native_thread_key); +} + +static int +ruby_thread_set_native(rb_thread_t *th) +{ + return pthread_setspecific(ruby_native_thread_key, th) == 0; +} + static void -Init_native_thread() +Init_native_thread(void) { - GET_THREAD()->thread_id = pthread_self(); + rb_thread_t *th = GET_THREAD(); + + pthread_key_create(&ruby_native_thread_key, NULL); + th->thread_id = pthread_self(); + ruby_thread_set_native(th); native_mutex_initialize(&signal_thread_list_lock); posix_signal(SIGVTALRM, null_func); } |