[PATCH] [MinGW] [Committed]: Win32 Threading Fixes for PR/14751

Mohan Embar gnustuff@thisiscool.com
Mon Sep 13 00:00:00 GMT 2004


Hi People,

I just checked in the following patch, which together with this:

http://gcc.gnu.org/ml/java-patches/2004-q3/msg00855.html

(which I also just committed) seems to fix PR/14751
(http://gcc.gnu.org/PR14751) on my Win2K and WinXP machines.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2004-09-11  Mohan Embar  <gnustuff@thisiscool.com>

	PR libgcj/14751
	* win32-threads.cc (_Jv_ThreadInitData): Zero out thread
	handle in newly-allocated _Jv_Thread_t.
	(_Jv_ThreadDestroyData): Close thread handle.
	(_Jv_ThreadStart): Remove obsolete comment.
	Store handle of newly-created thread in _Jv_Thread_t.
	* include/win32-threads.h: #define WIN32_LEAN_AND_MEAN
	before including <windows.h>
	#define _Jv_HaveCondDestroy

Index: win32-threads.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/win32-threads.cc,v
retrieving revision 1.11
diff -u -2 -r1.11 win32-threads.cc
--- win32-threads.cc	31 Oct 2003 03:36:38 -0000	1.11
+++ win32-threads.cc	8 Sep 2004 13:13:05 -0000
@@ -263,4 +263,5 @@
   _Jv_Thread_t *data = (_Jv_Thread_t*)_Jv_Malloc(sizeof(_Jv_Thread_t));
   data->flags = 0;
+  data->handle = 0;
   data->thread_obj = obj;
   data->interrupt_event = 0;
@@ -276,4 +277,5 @@
   if (data->interrupt_event)
     CloseHandle(data->interrupt_event);
+  CloseHandle(data->handle);
   _Jv_Free(data);
 }
@@ -366,5 +368,4 @@
   data->flags |= FLAG_START;
 
-  // FIXME: handle marking the info object for GC.
   info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter));
   info->method = meth;
@@ -380,5 +381,5 @@
     data->flags |= FLAG_DAEMON;
 
-  GC_CreateThread(NULL, 0, really_start, info, 0, &id);
+  data->handle = GC_CreateThread(NULL, 0, really_start, info, 0, &id);
   _Jv_ThreadSetPriority(data, thread->getPriority());
 }
Index: include/win32-threads.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/win32-threads.h,v
retrieving revision 1.9
diff -u -2 -r1.9 win32-threads.h
--- include/win32-threads.h	21 Oct 2003 04:46:19 -0000	1.9
+++ include/win32-threads.h	8 Sep 2004 13:13:07 -0000
@@ -14,4 +14,5 @@
 #define __JV_WIN32_THREADS__
 
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
@@ -76,4 +77,5 @@
 //
 
+#define _Jv_HaveCondDestroy
 int _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu, jlong millis, jint nanos);
 void _Jv_CondInit (_Jv_ConditionVariable_t *cv);






More information about the Java-patches mailing list