Преглед на файлове

2002-10-17 Dick Porter <[email protected]>

	* appdomain.c (mono_runtime_cleanup): Don't signal the async
	delegate semaphore before waiting for all threads to finish,
	because new threads can also call async delegates.  Fixes bug
	32004.

	* threadpool.c (async_invoke_thread): Only wait for 500ms instead
	of 3 seconds, in case another async job is queued.  (This part is
	needed because the bug fix reintroduced the 3s exit lag.)  This
	makes the mono_runtime_shutdown flag superfluous.

svn path=/trunk/mono/; revision=8353
Dick Porter преди 23 години
родител
ревизия
48880e656f
променени са 4 файла, в които са добавени 13 реда и са изтрити 16 реда
  1. 11 0
      mono/metadata/ChangeLog
  2. 0 6
      mono/metadata/appdomain.c
  3. 0 1
      mono/metadata/appdomain.h
  4. 2 9
      mono/metadata/threadpool.c

+ 11 - 0
mono/metadata/ChangeLog

@@ -1,3 +1,14 @@
+2002-10-17  Dick Porter  <[email protected]>
+
+	* appdomain.c (mono_runtime_cleanup): Don't signal the async
+	delegate semaphore before waiting for all threads to finish,
+	because new threads can also call async delegates.  Fixes bug
+	32004.
+
+	* threadpool.c (async_invoke_thread): Only wait for 500ms instead
+	of 3 seconds, in case another async job is queued.  (This part is
+	needed because the bug fix reintroduced the 3s exit lag.)  This
+	makes the mono_runtime_shutdown flag superfluous.
 
 Thu Oct 17 13:11:39 CEST 2002 Paolo Molaro <[email protected]>
 

+ 0 - 6
mono/metadata/appdomain.c

@@ -23,7 +23,6 @@
 
 HANDLE mono_delegate_semaphore = NULL;
 CRITICAL_SECTION mono_delegate_section;
-int mono_runtime_shutdown = 0;
 
 static MonoObject *
 mono_domain_transfer_object (MonoDomain *src, MonoDomain *dst, MonoObject *obj);
@@ -67,11 +66,6 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb)
 void
 mono_runtime_cleanup (MonoDomain *domain)
 {
-	mono_runtime_shutdown = 1;
-
-	/* signal all waiters in order to stop all workers (max. 0xffff) */
-	ReleaseSemaphore (mono_delegate_semaphore, 0xffff, NULL);
-
 	mono_thread_cleanup ();
 
 	/* Do this after the thread cleanup, because subthreads might

+ 0 - 1
mono/metadata/appdomain.h

@@ -91,7 +91,6 @@ extern MonoDomain *mono_root_domain;
 
 extern HANDLE mono_delegate_semaphore;
 extern CRITICAL_SECTION mono_delegate_section;
-extern int mono_runtime_shutdown;
 
 #define mono_domain_lock(domain)   EnterCriticalSection(&(domain)->lock)
 #define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)

+ 2 - 9
mono/metadata/threadpool.c

@@ -95,7 +95,7 @@ mono_thread_pool_add (MonoObject *target, MonoMethodMessage *msg, MonoDelegate *
 	ReleaseSemaphore (mono_delegate_semaphore, 1, NULL);
 
 	if (workers == 0) {
-		MonoObject *thread;
+		MonoThread *thread;
 		workers++;
 		thread = mono_thread_create (domain, async_invoke_thread);
 		g_assert (thread != NULL);
@@ -152,7 +152,7 @@ async_invoke_thread ()
 		MonoAsyncResult *ar;
 		gboolean new_worker = FALSE;
 
-		if (WaitForSingleObject (mono_delegate_semaphore, 3000) == WAIT_TIMEOUT) {
+		if (WaitForSingleObject (mono_delegate_semaphore, 500) == WAIT_TIMEOUT) {
 			EnterCriticalSection (&mono_delegate_section);
 			workers--;
 			LeaveCriticalSection (&mono_delegate_section);
@@ -176,13 +176,6 @@ async_invoke_thread ()
 
 		LeaveCriticalSection (&mono_delegate_section);
 
-		if (mono_runtime_shutdown) {
-			EnterCriticalSection (&mono_delegate_section);
-			workers--;
-			LeaveCriticalSection (&mono_delegate_section);
-			ExitThread (0);
-		}
-
 		if (!ar)
 			continue;