#include <mono/metadata/mono-debug.h>
#include <mono/metadata/mono-ptr-array.h>
#include <mono/metadata/verify-internals.h>
+#include <mono/metadata/runtime.h>
#include <mono/io-layer/io-layer.h>
#include <mono/utils/strtod.h>
#include <mono/utils/monobitset.h>
{
MONO_ARCH_SAVE_REGS;
+#ifndef MONO_CROSS_COMPILE
+ mono_runtime_shutdown ();
+#endif
+
mono_threads_set_shutting_down ();
mono_runtime_set_shutting_down ();
#include <mono/metadata/monitor.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/marshal.h>
+#include <mono/metadata/runtime.h>
#include <mono/io-layer/io-layer.h>
#ifndef HOST_WIN32
#include <mono/io-layer/threads.h>
THREAD_DEBUG (g_message ("%s: I have %d threads after waiting.", __func__, wait->num));
} while(wait->num>0);
+#ifndef MONO_CROSS_COMPILE
+ mono_runtime_shutdown ();
+#endif
+
mono_threads_set_shutting_down ();
/* No new threads will be created after this point */
#endif
#ifndef MONO_CROSS_COMPILE
- mono_runtime_shutdown ();
/*
- * mono_runtime_cleanup() and mono_domain_finalize () need to
- * be called early since they need the execution engine still
- * fully working (mono_domain_finalize may invoke managed finalizers
- * and mono_runtime_cleanup will wait for other threads to finish).
+ * mono_domain_finalize () needs to be called early since it needs the
+ * execution engine still fully working (it may invoke managed finalizers).
*/
mono_domain_finalize (domain, 2000);
#endif
sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile
touch libtest.c
-EXTRA_DIST += bug-438454.cs bug-438454.exe.stdout.expected
+EXTRA_DIST += bug-438454.cs bug-438454.exe.stdout.expected threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
test-process-exit:
@$(MCS) $(srcdir)/bug-438454.cs -out:bug-438454.exe
@echo "Testing bug-438454.exe..."
@$(RUNTIME) bug-438454.exe > bug-438454.exe.stdout
@diff -w bug-438454.exe.stdout $(srcdir)/bug-438454.exe.stdout.expected
+ @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
+ @echo "Testing threadpool-in-processexit.exe..."
+ @$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
+ @diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
OOM_TESTS = \
gc-oom-handling.exe \
--- /dev/null
+using System;
+using System.Threading;
+
+class Program
+{
+ static AutoResetEvent mre = new AutoResetEvent(false);
+
+ static void Main ()
+ {
+ AppDomain.CurrentDomain.ProcessExit += SomeEndOfProcessAction;
+ }
+
+ static void SomeEndOfProcessAction(object sender, EventArgs args)
+ {
+ ThreadPool.QueueUserWorkItem (new WaitCallback (ThreadPoolCallback));
+ if (mre.WaitOne(1000))
+ Console.WriteLine ("PASS");
+ else
+ Console.WriteLine ("FAIL");
+ }
+
+ static void ThreadPoolCallback (object state)
+ {
+ mre.Set ();
+ }
+}