[Mono-bugs] [Bug 67638][Nor] New - Calling mono_thread_attach() creates a foreground thread which prevents the app from exiting normally.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 5 Oct 2004 16:53:43 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by daniel_l_christensen@yahoo.com.

http://bugzilla.ximian.com/show_bug.cgi?id=67638

--- shadow/67638	2004-10-05 16:53:43.000000000 -0400
+++ shadow/67638.tmp.25638	2004-10-05 16:53:43.000000000 -0400
@@ -0,0 +1,37 @@
+Bug#: 67638
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: SuSE 9.1 Pro
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: daniel_l_christensen@yahoo.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Calling mono_thread_attach() creates a foreground thread which prevents the app from exiting normally.
+
+This is related to bug #66915
+
+I have a managed API that calls down into unmanaged code through p/invoke
+passing down a delegate marshalled as a function pointer. The unmanaged
+code starts up a new thread to complete an operation asynchronously. When
+the operation is complete it calls back on the function pointer to notify
+the managed API that the operation is complete.
+
+As noted in bug #66915, doing so causes the VM to crash (in Mono but not in
+.NET). I can work around the problem by adding a call to
+mono_thread_attach(). However, doing so causes a foreground thread to be
+created (Thread.IsBackground = false) and prevents the app from shutting
+down normally.
+
+Using .NET under Windows a background thread is created to wrap the
+unmanaged thread when it calls back into the managed code. The background
+thread does not block the process from exiting.
+
+I will attach a sample application that demonstrates the problem.