mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c: clear thread structure.
(TODO: survey that child process should clear mutex or not). * bootstraptest/test_knownbug.rb, test_thread.rb: move a fixed test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4b8de30bc5
commit
5360e77db8
3 changed files with 28 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Jan 14 18:53:58 2008 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread.c: clear thread structure.
|
||||
(TODO: survey that child process should clear mutex or not).
|
||||
|
||||
* bootstraptest/test_knownbug.rb, test_thread.rb: move a fixed test.
|
||||
|
||||
Mon Jan 14 18:43:38 2008 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* bootstraptest/runner.rb: add "flunk" method.
|
||||
|
|
|
@ -193,3 +193,11 @@ rescue
|
|||
100
|
||||
end
|
||||
}, '[ruby-dev:31371]'
|
||||
assert_equal 'true', %{
|
||||
t = Thread.new { loop {} }
|
||||
pid = fork {
|
||||
exit t.status != "run"
|
||||
}
|
||||
Process.wait pid
|
||||
$?.success?
|
||||
}
|
||||
|
|
14
thread.c
14
thread.c
|
@ -1955,7 +1955,18 @@ rb_thread_start_timer_thread(void)
|
|||
rb_thread_create_timer_thread();
|
||||
}
|
||||
|
||||
/***/
|
||||
static int
|
||||
terminate_atfork_i(st_data_t key, st_data_t val, rb_thread_t *current_th)
|
||||
{
|
||||
VALUE thval = key;
|
||||
rb_thread_t *th;
|
||||
GetThreadPtr(thval, th);
|
||||
|
||||
if (th != current_th) {
|
||||
thread_cleanup_func(th);
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
void
|
||||
rb_thread_atfork(void)
|
||||
|
@ -1965,6 +1976,7 @@ rb_thread_atfork(void)
|
|||
VALUE thval = th->self;
|
||||
vm->main_thread = th;
|
||||
|
||||
st_foreach(vm->living_threads, terminate_atfork_i, (st_data_t)th);
|
||||
st_clear(vm->living_threads);
|
||||
st_insert(vm->living_threads, thval, (st_data_t) th->thread_id);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue