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 | 769ff25033ff891e1487dfc7b714f0daa6ebdf65 (patch) | |
| tree | 966dc305bfddb1b740f825806de4720d8e720825 /thread_pthread.ci | |
| parent | a4e9109c72bf0b7201b29df242b03c061928fbc3 (diff) | |
| download | ruby-769ff25033ff891e1487dfc7b714f0daa6ebdf65.tar.gz ruby-769ff25033ff891e1487dfc7b714f0daa6ebdf65.tar.xz ruby-769ff25033ff891e1487dfc7b714f0daa6ebdf65.zip | |
* thread.c (is_ruby_native_thread): check properly. [ruby-dev:31166]
git-svn-id: http://svn.ruby-lang.org/repos/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 d624e9848..b8b609145 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); } |
