summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 13:52:34 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 13:52:34 +0000
commit15b25acd2541ae37f4f874b50128d34d8b079457 (patch)
tree81e7d590c4cf77775ce25653b9091b3ece42e587 /vm_core.h
parent2e72d1c3236c8ec1c0cb8f35c1dd6b64fde02fce (diff)
* vm_core.h (rb_vm_struct): add thread_destruct_lock field.
* thread.c (Init_Thread): ditto. * thread.c (rb_vm_gvl_destroy): ditto. * thread.c (thread_start_func_2): make sure vm->running_thread don't point to dead thread. * thread.c (timer_thread_function): close a race against thead destruction. [Bug #4911][ruby-dev:43859] * vm_core.h (rb_thread_set_current): reset running time of current thread instead of previous thread. We no longer assume previous running thread still live. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/vm_core.h b/vm_core.h
index 96b55c4931..dcd6cd109e 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -333,6 +333,7 @@ typedef struct rb_vm_struct {
VALUE self;
rb_global_vm_lock_t gvl;
+ rb_thread_lock_t thread_destruct_lock;
struct rb_thread_struct *main_thread;
struct rb_thread_struct *running_thread;
@@ -850,7 +851,7 @@ GET_THREAD(void)
#define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
#define rb_thread_set_current(th) do { \
if ((th)->vm->running_thread != (th)) { \
- (th)->vm->running_thread->running_time_us = 0; \
+ (th)->running_time_us = 0; \
} \
rb_thread_set_current_raw(th); \
(th)->vm->running_thread = (th); \