ruby-changes:18034
From: shyouhei <ko1@a...>
Date: Fri, 3 Dec 2010 00:00:39 +0900 (JST)
Subject: [ruby-changes:18034] Ruby:r30055 (trunk): * NEWS: entry for ruby_vm_at_exit().
shyouhei 2010-12-02 23:58:41 +0900 (Thu, 02 Dec 2010) New Revision: 30055 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30055 Log: * NEWS: entry for ruby_vm_at_exit(). * eval.c (ruby_cleanup): bug fix around at_exit (1) timing was wrong. (2) execution order was opposite. Modified files: trunk/ChangeLog trunk/NEWS trunk/eval.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30054) +++ ChangeLog (revision 30055) @@ -1,3 +1,10 @@ +Thu Dec 2 23:52:26 2010 URABE Shyouhei <shyouhei@r...> + + * NEWS: entry for ruby_vm_at_exit(). + + * eval.c (ruby_cleanup): bug fix around at_exit (1) timing was + wrong. (2) execution order was opposite. + Thu Dec 2 23:05:14 2010 NAKAMURA Usaku <usa@r...> * win32/Makefile.sub (RCFLAGS): -nologo switch is only available in Index: eval.c =================================================================== --- eval.c (revision 30054) +++ eval.c (revision 30055) @@ -151,13 +151,6 @@ } POP_TAG(); - /* at_exit functions called here; any other place more apropriate - * for this purpose? let me know if any. */ - for (i=0; i<RARRAY_LEN(ary); i++) { - ((void(*)(rb_vm_t*))RARRAY_PTR(ary)[i])(vm); - } - rb_ary_clear(ary); - errs[0] = th->errinfo; PUSH_TAG(); if ((state = EXEC_TAG()) == 0) { @@ -172,6 +165,13 @@ POP_TAG(); rb_thread_stop_timer_thread(); + /* at_exit functions called here; any other place more apropriate + * for this purpose? let me know if any. */ + for (i=RARRAY_LEN(ary) - 1; i>=0; i--) { + ((void(*)(rb_vm_t*))RARRAY_PTR(ary)[i])(vm); + } + rb_ary_clear(ary); + #if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1 switch (ex) { #if EXIT_SUCCESS != 0 Index: NEWS =================================================================== --- NEWS (revision 30054) +++ NEWS (revision 30055) @@ -19,6 +19,9 @@ * rb_scan_args() is enhanced with support for option hash argument extraction. +* ruby_vm_at_exit() added. This enables extension libs to hool a VM + termination. + === Library updates (outstanding ones only) * builtin classes -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/