$OpenBSD: patch-mono_io-layer_wthreads_c,v 1.1 2013/01/24 13:52:09 kurt Exp $
--- mono/io-layer/wthreads.c.orig	Mon Jan 30 13:01:23 2012
+++ mono/io-layer/wthreads.c	Mon Jan 21 16:48:48 2013
@@ -248,9 +248,11 @@ static void *thread_start_routine (gpointer args)
 {
 	struct _WapiHandle_thread *thread = (struct _WapiHandle_thread *)args;
 	int thr_ret;
-	
-	thr_ret = mono_gc_pthread_detach (pthread_self ());
-	g_assert (thr_ret == 0);
+
+	if (!(thread->create_flags & CREATE_NO_DETACH)) {
+		thr_ret = mono_gc_pthread_detach (pthread_self ());
+		g_assert (thr_ret == 0);
+	}
 
 	thr_ret = pthread_setspecific (thread_hash_key,
 				       (void *)thread->handle);
