JvAttachCurrentThread doesn't seem to call GC_new_thread

Per Bothner per@bothner.com
Mon Jan 26 21:22:00 GMT 2004


I got a bug report from a client about aborting with "Collecting from 
unknown thread", which is in GC_push_all_stacks in win32_threads.c. 
This was from a native thread that he called JvAttachCurrentThread on.

So I looked at the code trying to understand what should happen.  It 
looks to me that JvAttachCurrentThread needs to call GC_new_thread to 
register itself.

I also looks like GC_new_thread is only called by GC_thr_init and 
GC_start_routine.  GC_thr_init is called once when the GC system is 
initialized, and it only calls GC_new_thread once on the current thread. 
GC_start_routine is called when starting a new thread (in the pthread 
case by pthread_create).

It looks to me like we don't handle the case of a native thread that is 
not the initial thread.  This applies to both pthreads (Posix) and Win32.

Am I missing something?  Or is this a known limitation?  Would it be 
difficult to fix?  Obviously some locking is needed.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/




More information about the Java mailing list