mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
mark_end_proc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ebab487fcd
commit
2b49047143
4 changed files with 25 additions and 20 deletions
22
eval.c
22
eval.c
|
@ -5232,10 +5232,20 @@ rb_set_end_proc(func, data)
|
|||
link->next = end_proc_data;
|
||||
link->func = func;
|
||||
link->data = data;
|
||||
rb_global_variable(&link->data);
|
||||
end_proc_data = link;
|
||||
}
|
||||
|
||||
void
|
||||
rb_mark_end_proc()
|
||||
{
|
||||
struct end_proc_data *link = end_proc_data;
|
||||
|
||||
while (link) {
|
||||
rb_gc_mark(link->data);
|
||||
link = link->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
call_end_proc(data)
|
||||
VALUE data;
|
||||
|
@ -5266,17 +5276,15 @@ rb_f_at_exit()
|
|||
void
|
||||
rb_exec_end_proc()
|
||||
{
|
||||
struct end_proc_data *link = end_proc_data;
|
||||
struct end_proc_data *tmp;
|
||||
struct end_proc_data *link;
|
||||
int status;
|
||||
|
||||
while (link) {
|
||||
while (end_proc_data) {
|
||||
link = end_proc_data;
|
||||
end_proc_data = link->next;
|
||||
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||
tmp = link->next;
|
||||
free(link);
|
||||
link = tmp;
|
||||
}
|
||||
end_proc_data = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue