mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_gc_mark_threads): keep unmarked threads which won't wake
up alone, and mark threads in the loading table. [ruby-dev:28154] * eval.c (rb_gc_abort_threads), gc.c (gc_sweep): kill unmarked threads. [ruby-dev:28172] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6779556b23
commit
fe3cba8e6f
3 changed files with 43 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Dec 29 23:59:37 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_gc_mark_threads): keep unmarked threads which won't wake
|
||||
up alone, and mark threads in the loading table. [ruby-dev:28154]
|
||||
|
||||
* eval.c (rb_gc_abort_threads), gc.c (gc_sweep): kill unmarked
|
||||
threads. [ruby-dev:28172]
|
||||
|
||||
Thu Dec 29 17:02:07 2005 Tanaka Akira <akr@m17n.org>
|
||||
|
||||
* test/ruby/envutil.rb (EnvUtil.rubybin): search "ruby" instead of
|
||||
|
|
33
eval.c
33
eval.c
|
@ -9987,6 +9987,13 @@ static struct {
|
|||
VALUE proc, arg;
|
||||
} new_thread;
|
||||
|
||||
static int
|
||||
mark_loading_thread(ID key, VALUE value, int lev)
|
||||
{
|
||||
rb_gc_mark(((rb_thread_t)value)->thread);
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
void
|
||||
rb_gc_mark_threads(void)
|
||||
{
|
||||
|
@ -9996,7 +10003,18 @@ rb_gc_mark_threads(void)
|
|||
rb_gc_mark((VALUE)ruby_cref);
|
||||
|
||||
if (!curr_thread) return;
|
||||
rb_gc_mark(main_thread->thread);
|
||||
rb_gc_mark(curr_thread->thread);
|
||||
FOREACH_THREAD_FROM(main_thread, th) {
|
||||
switch (th->status) {
|
||||
case THREAD_TO_KILL:
|
||||
case THREAD_RUNNABLE:
|
||||
break;
|
||||
case THREAD_STOPPED:
|
||||
if (th->wait_for) break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
rb_gc_mark(th->thread);
|
||||
} END_FOREACH_FROM(main_thread, th);
|
||||
if (new_thread.thread) {
|
||||
|
@ -10004,6 +10022,21 @@ rb_gc_mark_threads(void)
|
|||
rb_gc_mark(new_thread.proc);
|
||||
rb_gc_mark(new_thread.arg);
|
||||
}
|
||||
if (loading_tbl) st_foreach(loading_tbl, mark_loading_thread, 0);
|
||||
}
|
||||
|
||||
void
|
||||
rb_gc_abort_threads(void)
|
||||
{
|
||||
rb_thread_t th;
|
||||
|
||||
FOREACH_THREAD_FROM(main_thread, th) {
|
||||
if (FL_TEST(th->thread, FL_MARK)) continue;
|
||||
if (th->status == THREAD_STOPPED) {
|
||||
th->status = THREAD_TO_KILL;
|
||||
rb_gc_mark(th->thread);
|
||||
}
|
||||
} END_FOREACH_FROM(main_thread, th);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
2
gc.c
2
gc.c
|
@ -1015,6 +1015,8 @@ gc_sweep(void)
|
|||
st_foreach(source_filenames, sweep_source_filename, 0);
|
||||
}
|
||||
|
||||
rb_gc_abort_threads();
|
||||
|
||||
freelist = 0;
|
||||
final_list = deferred_final_list;
|
||||
deferred_final_list = 0;
|
||||
|
|
Loading…
Reference in a new issue