* thread.c (rb_threadptr_execute_interrupts_common): increase
running_time_us on THREAD_TO_KILL like on THREAD_RUNNABLE. This cause not to siwtch from a thread which is to be killed on FreeBSD and Mac OS X. see also the test. This issue maybe exist for long time but happens after r36430. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
478d37da05
commit
ee755e2ce9
@ -1,3 +1,11 @@
|
||||
Sun Jul 22 23:58:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* thread.c (rb_threadptr_execute_interrupts_common): increase
|
||||
running_time_us on THREAD_TO_KILL like on THREAD_RUNNABLE.
|
||||
This cause not to siwtch from a thread which is to be killed
|
||||
on FreeBSD and Mac OS X. see also the test.
|
||||
This issue maybe exist for long time but happens after r36430.
|
||||
|
||||
Sat Jul 21 06:21:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/net/http.rb: fixes for r36476. [Feature #6546]
|
||||
|
@ -774,4 +774,22 @@ class TestThreadGroup < Test::Unit::TestCase
|
||||
end
|
||||
assert_in_delta(t1 - t0, 1, 1)
|
||||
end
|
||||
|
||||
def test_thread_timer_and_ensure
|
||||
exit = false
|
||||
t = Thread.new do
|
||||
begin
|
||||
sleep
|
||||
ensure
|
||||
1 until exit # Ruby 1.8 won't switch threads here
|
||||
end
|
||||
end
|
||||
|
||||
Thread.pass until t.status == "sleep"
|
||||
|
||||
t.kill
|
||||
t.alive? == true
|
||||
exit = true
|
||||
t.join
|
||||
end
|
||||
end
|
||||
|
2
thread.c
2
thread.c
@ -1742,7 +1742,7 @@ rb_threadptr_execute_interrupts_common(rb_thread_t *th, int blocking_timing)
|
||||
else
|
||||
limits_us >>= -th->priority;
|
||||
|
||||
if (status == THREAD_RUNNABLE)
|
||||
if (status == THREAD_RUNNABLE || status == THREAD_TO_KILL)
|
||||
th->running_time_us += TIME_QUANTUM_USEC;
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_SWITCH, th->cfp->self, 0, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user