All pastes #1942399 Raw Edit

Someone

public diff v1 · immutable
#1942399 ·published 2010-09-16 21:10 UTC
rendered paste body
diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.cindex 2420c3d..50d2b29 100644--- a/mono/metadata/threadpool.c+++ b/mono/metadata/threadpool.c@@ -25,6 +25,7 @@ #include <mono/metadata/threadpool-internals.h> #include <mono/metadata/exception.h> #include <mono/metadata/file-io.h>+#include <mono/metadata/gc-internal.h> #include <mono/metadata/monitor.h> #include <mono/metadata/mono-mlist.h> #include <mono/metadata/marshal.h>@@ -129,10 +130,11 @@ typedef struct { } ASyncCall;  typedef struct {-	MonoSemType lock;+	/* Do NOT move 'first', 'last' or 'unused' around. */ 	MonoMList *first; /* GC root */-	MonoMList *last; 	MonoMList *unused; /* Up to 20 chunks. GC root */+	MonoMList *last;+	MonoSemType lock; 	gint head; 	gint tail; 	MonoSemType new_job;@@ -1187,6 +1189,8 @@ mono_thread_pool_init () 	gint thread_count; 	gint cpu_count = mono_cpu_count (); 	int result;+	gsize bitmap;+	void *descr;  	if (tp_inited == 2) 		return;@@ -1200,14 +1204,14 @@ mono_thread_pool_init () 		} 	} -	MONO_GC_REGISTER_ROOT (async_tp.first);-	MONO_GC_REGISTER_ROOT (async_tp.last);-	MONO_GC_REGISTER_ROOT (async_tp.unused);-	MONO_GC_REGISTER_ROOT (async_io_tp.first);-	MONO_GC_REGISTER_ROOT (async_io_tp.unused);-	MONO_GC_REGISTER_ROOT (async_io_tp.last);+	bitmap = 7;+	descr = mono_gc_make_descr_from_bitmap (&bitmap, 2);+	mono_gc_register_root ((char *) &async_tp, sizeof (gpointer) * 2, descr);+	mono_gc_register_root ((char *) &async_io_tp, sizeof (gpointer) * 2, descr);+	bitmap = 1;+	descr = mono_gc_make_descr_from_bitmap (&bitmap, 1);+	mono_gc_register_root ((char *) &socket_io_data.sock_to_state, sizeof (gpointer), descr); -	MONO_GC_REGISTER_ROOT (socket_io_data.sock_to_state); 	InitializeCriticalSection (&socket_io_data.io_lock); 	if (g_getenv ("MONO_THREADS_PER_CPU") != NULL) { 		threads_per_cpu = atoi (g_getenv ("MONO_THREADS_PER_CPU"));@@ -1346,6 +1350,8 @@ mono_thread_pool_cleanup (void) 			threadpool_kill_idle_threads (&async_io_tp); 			MONO_SEM_POST (&async_io_tp.lock); 			MONO_SEM_DESTROY (&async_io_tp.new_job);+			mono_gc_deregister_root ((char *) &socket_io_data.sock_to_state);+			mono_gc_deregister_root ((char *) &async_io_tp); 		} 	} @@ -1356,6 +1362,7 @@ mono_thread_pool_cleanup (void) 	wsqs = NULL; 	LeaveCriticalSection (&wsqs_lock); 	MONO_SEM_DESTROY (&async_tp.new_job);+	mono_gc_deregister_root ((char *) &async_tp); }  /* Caller must enter &tp->lock */