Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-03-19 04:36:11 +0300
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-03-19 04:36:11 +0300
commitf77844a3455acd2fd671102406f92650af6f35e7 (patch)
tree59a8a5888dabb6759baf366c8ddcec82ea45c16b
parent16fcacf2300966fdc3e7a248708848345d33b55b (diff)
2004-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* threads.c: set mono_thread_detach as a cleanup routine for every thread. This way it's always executed upon thread termination, either aborted or finished normally. No more xsp hangs! svn path=/trunk/mono/; revision=24315
-rw-r--r--mono/metadata/ChangeLog6
-rw-r--r--mono/metadata/threads.c17
2 files changed, 21 insertions, 2 deletions
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index cbc0ea967d2..14f8002c9c6 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * threads.c: set mono_thread_detach as a cleanup routine for every
+ thread. This way it's always executed upon thread termination, either
+ aborted or finished normally. No more xsp hangs!
+
2004-03-17 Martin Baulig <martin@ximian.com>
* class.h (MonoGenericInst): Replaced the `GList *nested' with an
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
index 59617edab3e..9048c96b0cc 100644
--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c
@@ -12,6 +12,7 @@
#include <config.h>
#include <glib.h>
#include <signal.h>
+#include <string.h>
#include <mono/metadata/object.h>
#include <mono/metadata/appdomain.h>
@@ -228,9 +229,15 @@ static guint32 start_wrapper(void *data)
mono_thread_push_appdomain_ref (mono_domain_get ());
thread_adjust_static_data (thread);
+#ifndef PLATFORM_WIN32
+#ifdef DEBUG
+ g_print ("start_wrapper for %d\n", thread->tid);
+#endif
+ pthread_cleanup_push ((void (*) (void *)) mono_thread_detach, thread);
+#endif
start_func (this);
-
+#ifdef PLATFORM_WIN32
/* If the thread calls ExitThread at all, this remaining code
* will not be executed, but the main thread will eventually
* call thread_cleanup() on this thread's behalf.
@@ -252,7 +259,10 @@ static guint32 start_wrapper(void *data)
TlsSetValue (current_object_key, NULL);
thread_cleanup (thread);
-
+#else
+ pthread_cleanup_pop (1);
+#endif
+
return(0);
}
@@ -364,6 +374,9 @@ mono_thread_detach (MonoThread *thread)
{
g_return_if_fail (thread != NULL);
+#ifdef DEBUG
+ g_print ("mono_thread_detach for %d\n", thread->tid);
+#endif
TlsSetValue (current_object_key, NULL);
thread_cleanup (thread);