[Gc] win32_pthreads

Boehm, Hans hans.boehm at hp.com
Thu May 24 17:53:40 PDT 2007


Thanks.  I applied it to my tree.


Hans 

> -----Original Message-----
> From: Romano Paolo Tenca [mailto:rotenca at telvia.it] 
> Sent: Thursday, May 24, 2007 1:23 PM
> To: Boehm, Hans
> Cc: Gc at napali.hpl.hp.com
> Subject: Re: [Gc] win32_pthreads
> 
> 
> I have understood (i hope) why the win32 pthread 
> implementation fails when the debug options are active.
> 
> I think to have found two problems in the GC pthread implementation:
> 
> 1) In GC_pthread_start_inner() the line:
> 
>      pthread_cleanup_pop(0);
> 
>  should be:
> 
>      pthread_cleanup_pop(1);
> 
> else the routine GC_thread_exit_proc () is not called. 
> Another solution is to put the same code of 
> GC_thread_exit_proc() in GC_pthread_start_inner().
> This should be a problem also under Cygwin.
> 
> 2) Under win32_pthread and Mingw (also under Cygwin?) a 
> joinable thread which has completed its code and is ready to 
> be joined cannot be suspended with native Windows 
> SuspendThread() (the pthread library has already called 
> _endthread), so GC_stop_world() will fail.
> And if a thread is not in suspended mode, GetThreadContext() 
> cannot be called by GC_push_stack_for().
> 
> Probably there are different solutions to this problem. One 
> of them could be to check the FINISHED flags set by 
> GC_thread_exit_proc(), if the flags is set the thread should 
> be ignored by GC_stop_world() and by GC_push_stack_for().
> 
> With these changes, gctest works a lot better whith debug 
> flag. It hangs only if GC_printf is called from 
> GC_push_stack_for(). I can't explain why. :-(
> 
> See my patch.
> 
> --
> Romano Paolo Tenca
> 
> 



More information about the Gc mailing list