Kouhei Sutou
null+****@clear*****
Sat Aug 13 11:43:44 JST 2016
Kouhei Sutou 2016-08-13 11:43:44 +0900 (Sat, 13 Aug 2016) New Revision: 20720274771702d4914d0e4576330041ff68cf2b https://github.com/ranguba/rroonga/commit/20720274771702d4914d0e4576330041ff68cf2b Message: Use finalizer instead of end_proc Because end_proc mechanism may cause a problem with library that uses at_exit such as test-unit. test-unit uses at_exit to run tests automatically. In the following sequence, tests are run after libgroonga is finished: 1. require "test/unit" 2. require "groonga" Because end_proc/at_exit callbacks are run in reverse defined order. Finalizer is always run after all end_proc/at_exit callbacks are run. Modified files: ext/groonga/rb-groonga.c Modified: ext/groonga/rb-groonga.c (+3 -2) =================================================================== --- ext/groonga/rb-groonga.c 2016-08-13 11:42:51 +0900 (a05c2e0) +++ ext/groonga/rb-groonga.c 2016-08-13 11:43:44 +0900 (06d52a7) @@ -21,13 +21,14 @@ grn_bool rb_grn_exited = GRN_FALSE; -static void +static VALUE finish_groonga (VALUE data) { debug("finish\n"); grn_fin(); rb_grn_exited = GRN_TRUE; debug("finish: done\n"); + return Qnil; } /* @@ -212,7 +213,7 @@ Init_groonga (void) rb_grn_init_exception(mGrn); rb_grn_rc_check(grn_init(), Qnil); - rb_set_end_proc(finish_groonga, Qnil); + rb_define_finalizer(mGrn, rb_proc_new(finish_groonga, Qnil)); rb_grn_init_version(mGrn); rb_grn_init_lock_timeout(mGrn); -------------- next part -------------- HTML����������������������������... Télécharger