summaryrefslogtreecommitdiff
path: root/lang/mono2/patches/patch-dg
diff options
context:
space:
mode:
Diffstat (limited to 'lang/mono2/patches/patch-dg')
-rw-r--r--lang/mono2/patches/patch-dg65
1 files changed, 65 insertions, 0 deletions
diff --git a/lang/mono2/patches/patch-dg b/lang/mono2/patches/patch-dg
new file mode 100644
index 00000000000..45dac7fc904
--- /dev/null
+++ b/lang/mono2/patches/patch-dg
@@ -0,0 +1,65 @@
+$NetBSD: patch-dg,v 1.1 2013/06/17 12:43:28 wiz Exp $
+
+Avoid calling pthread_setspecific via SET_CURRENT_OBJECT(NULL)
+after the key has been removed. This can result in hangs or
+assertions.
+
+--- mono/metadata/threads.c.orig 2012-01-30 18:01:23.000000000 +0000
++++ mono/metadata/threads.c
+@@ -1,3 +1,4 @@
++
+ /*
+ * threads.c: Thread support internal calls
+ *
+@@ -77,6 +78,8 @@ extern int tkill (pid_t tid, int signal)
+ # endif
+ #endif
+
++static int tls_key_initialised;
++
+ struct StartInfo
+ {
+ guint32 (*func)(void *);
+@@ -814,7 +817,8 @@ static guint32 WINAPI start_wrapper_inte
+ * Boehm GC - the io-layer keeps a GC-visible hash of pointers
+ * to TLS data.)
+ */
+- SET_CURRENT_OBJECT (NULL);
++ if (tls_key_initialised)
++ SET_CURRENT_OBJECT (NULL);
+ mono_domain_unset ();
+
+ return(0);
+@@ -1016,8 +1020,16 @@ mono_thread_get_stack_bounds (guint8 **s
+ # if !defined(__OpenBSD__)
+ pthread_attr_getstack (&attr, (void**)staddr, stsize);
+ # endif
++ /*
++ * he@NetBSD.org: For some reason, this test fails on NetBSD/powerpc,
++ * so just avoid it.
++ * kefren@: as a hint if somebody want to take a closer look: this
++ * triggers also when building in a i386 chroot on amd64
++ */
++# if !(defined(__NetBSD__) && defined(__powerpc__))
+ if (*staddr)
+ g_assert ((current > *staddr) && (current < *staddr + *stsize));
++# endif
+ # endif
+
+ pthread_attr_destroy (&attr);
+@@ -2651,6 +2663,7 @@ void mono_thread_init (MonoThreadStartCB
+ mono_init_static_data_info (&context_static_info);
+
+ mono_native_tls_alloc (&current_object_key, NULL);
++ tls_key_initialised = 1;
+ THREAD_DEBUG (g_message ("%s: Allocated current_object_key %d", __func__, current_object_key));
+
+ mono_thread_start_cb = start_cb;
+@@ -2701,6 +2714,7 @@ void mono_thread_cleanup (void)
+ delayed_free_table = NULL;
+
+ mono_native_tls_free (current_object_key);
++ tls_key_initialised = 0;
+ }
+
+ void