[Ecls-list] Threaded MSVC broken.

Samium Gromoff _deepfire at feelingofgreen.ru
Wed Jun 25 14:53:46 UTC 2008


From: Samium Gromoff <_deepfire at feelingofgreen.ru>
> From: "Juan Jose Garcia-Ripoll" <juanjose.garciaripoll at googlemail.com>
> > Hi Samium,
> > 
> > sorry for the delay. It will take me some time to get back to the
> > multithreaded MSVC build, but thanks for the information. The fact
> > that the signal is produced in the garbage collector is no good
> > symptom -- may be that the garbage collector is running out of memory.
> 
> Okay, I think I've got the gist of it:
> 
> DllMain()
>  GC_init()
>    GC_init_inner(), sets GC_all_inferior_pointers to 1
>      GC_init_bl(), does its init according to GC_a_i_p being 1
> ....
> main()
>  cl_boot()
>    init_alloc(), sets GC_all_inferior_pointers to 0
>      GC_init()
>        GC_init_inner(), sees GC_is_initialised, bails out
>        ... GC_init_bl() is never called again ...
> .... a part of GC is left configured with GC_a_i_p set to 0
> 
> some code (in the init_threads()) calls cl_alloc(), trips up...
> 
> Now, question is who gets to call GC_init() -- DllMain() or cl_boot()...

As an attempt to answer that question, the attached patch was found
to pass initialization well enough to arrive at the REPL.

I didn't test it, beyond running the REPL yet..


regards, Samium Gromoff


diff --git a/src/gc/win32_threads.c b/src/gc/win32_threads.c
--- a/src/gc/win32_threads.c
+++ b/src/gc/win32_threads.c
@@ -763,8 +763,6 @@ int GC_pthread_detach(pthread_t thread)
 BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
 {
   switch (reason) {
-  case DLL_PROCESS_ATTACH:
-    GC_init(); /* Force initialization before thread attach.   */
     /* fall through */
   case DLL_THREAD_ATTACH:
     GC_ASSERT(GC_thr_initialized);

     




More information about the ecl-devel mailing list