@@ -658,7 +658,6 @@ static void ruby_init_interpreter(server_rec *s)
658
658
RETSIGTYPE (* sigterm_handler )_ ((int ));
659
659
#endif
660
660
#ifdef RUBY_VM
661
- void Init_prelude (void );
662
661
RUBY_INIT_STACK ;
663
662
#else
664
663
VALUE stack_start ;
@@ -704,7 +703,7 @@ static void ruby_init_interpreter(server_rec *s)
704
703
705
704
ruby_init_loadpath ();
706
705
#ifdef RUBY_VM
707
- Init_prelude ();
706
+ ruby_init_prelude ();
708
707
#endif
709
708
default_load_path = rb_ary_dup (GET_LOAD_PATH ());
710
709
rb_global_variable (& default_load_path );
@@ -734,6 +733,7 @@ static void ruby_init_interpreter(server_rec *s)
734
733
}
735
734
}
736
735
736
+ #ifndef RUBY_VM
737
737
static void dso_unload (void * handle )
738
738
{
739
739
#if defined(_WIN32 )
@@ -747,16 +747,24 @@ static void dso_unload(void *handle)
747
747
#endif
748
748
}
749
749
750
- static void ruby_finalize_interpreter ()
750
+ static void ruby_unload_libraries ()
751
751
{
752
752
RUBY_EXTERN VALUE ruby_dln_librefs ;
753
753
int i ;
754
754
755
- ruby_finalize ();
756
755
for (i = 0 ; i < RARRAY_LEN (ruby_dln_librefs ); i ++ ) {
757
756
dso_unload ((void * ) NUM2LONG (RARRAY_PTR (ruby_dln_librefs )[i ]));
758
757
}
759
758
}
759
+ #endif
760
+
761
+ static void ruby_finalize_interpreter ()
762
+ {
763
+ ruby_finalize ();
764
+ #ifndef RUBY_VM
765
+ ruby_unload_libraries ();
766
+ #endif
767
+ }
760
768
761
769
#if APR_HAS_THREADS
762
770
static void * APR_THREAD_FUNC ruby_thread_start (apr_thread_t * t , void * data )
@@ -1006,8 +1014,7 @@ void rb_setup_cgi_env(request_rec *r)
1006
1014
1007
1015
static VALUE kill_threads (VALUE arg )
1008
1016
{
1009
- extern VALUE rb_thread_list ();
1010
- VALUE threads = rb_thread_list ();
1017
+ VALUE threads = rb_protect_funcall (rb_cThread , rb_intern ("list" ), NULL , 0 );
1011
1018
VALUE main_thread = rb_thread_main ();
1012
1019
VALUE th ;
1013
1020
int i ;
0 commit comments