summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 13:47:23 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 13:47:23 +0000
commit39d38ff82f3a6158d2adc5883b86691a424ed1c0 (patch)
treece53fabe419de4d3842b8f0a3c2c115800f4a7db /thread.c
parent66e2e6ee697a322bb7521d7ecaff6be3fb69f4dd (diff)
downloadbundler-39d38ff82f3a6158d2adc5883b86691a424ed1c0.tar.gz
* thread.c (rb_thread_terminate_all): use native_sleep() instead
of rb_thread_schedule(). Otherwise, it consume 100% cpu meaninglessly. [Bug #5368] [ruby-dev:44546] * thread.c (thread_start_func_2): last sub-thread wakes up main thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index 0ff0794785..3fb97d2342 100644
--- a/thread.c
+++ b/thread.c
@@ -385,7 +385,7 @@ rb_thread_terminate_all(void)
while (!rb_thread_alone()) {
PUSH_TAG();
if (EXEC_TAG() == 0) {
- rb_thread_schedule();
+ native_sleep(th, 0);
}
else {
/* ignore exception */
@@ -522,6 +522,9 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
/* delete self other than main thread from living_threads */
if (th != main_th) {
st_delete_wrap(th->vm->living_threads, th->self);
+ if (rb_thread_alone()) {
+ rb_threadptr_interrupt(main_th);
+ }
}
/* wake up joining threads */