diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-13 21:34:20 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-13 21:34:20 +0000 |
commit | 48b6bd74e2febde095ac85d818e94c0e58677647 (patch) | |
tree | 73348a2cf6a66b1f1d6620b93109b7f7dfb0ca03 /thread_pthread.h | |
parent | 4d2e0fffb08f0418fa6995be2e15aad7ee11b048 (diff) |
thread_pthread.c: eliminate timer thread by restructuring GVL
This reverts commit 194a6a2c68e9c8a3536b24db18ceac87535a6051 (r64203).
Race conditions which caused the original reversion will be fixed
in the subsequent commit.
[ruby-core:88360] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.h')
-rw-r--r-- | thread_pthread.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/thread_pthread.h b/thread_pthread.h index 0566193eb5..60e0fe0ea3 100644 --- a/thread_pthread.h +++ b/thread_pthread.h @@ -22,7 +22,19 @@ typedef pthread_cond_t rb_nativethread_cond_t; typedef struct native_thread_data_struct { struct list_node ubf_list; - rb_nativethread_cond_t sleep_cond; +#if defined(__GLIBC__) || defined(__FreeBSD__) + union +#else + /* + * assume the platform condvars are badly implemented and have a + * "memory" of which mutex they're associated with + */ + struct +#endif + { + rb_nativethread_cond_t intr; /* th->interrupt_lock */ + rb_nativethread_cond_t gvlq; /* vm->gvl.lock */ + } cond; } native_thread_data_t; #undef except @@ -32,12 +44,12 @@ typedef struct native_thread_data_struct { typedef struct rb_global_vm_lock_struct { /* fast path */ - unsigned long acquired; + const struct rb_thread_struct *acquired; rb_nativethread_lock_t lock; /* slow path */ - volatile unsigned long waiting; - rb_nativethread_cond_t cond; + struct list_head waitq; + const struct rb_thread_struct *timer; /* yield */ rb_nativethread_cond_t switch_cond; |