#if defined(USE_WINDOWS_BACKEND)
#include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-threads-debug.h>
#include <limits.h>
}
CloseHandle (handle);
- return info->suspend_can_continue;
+ return TRUE;
}
gboolean
return info->suspend_can_continue;
}
+static void CALLBACK
+abort_apc (ULONG_PTR param)
+{
+ THREADS_INTERRUPT_DEBUG ("%06d - abort_apc () called", GetCurrentThreadId ());
+}
+
+void
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
+{
+ DWORD id = mono_thread_info_get_tid (info);
+ HANDLE handle;
+
+ handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+ g_assert (handle);
+
+ THREADS_INTERRUPT_DEBUG ("%06d - Aborting syscall in thread %06d", GetCurrentThreadId (), id);
+ QueueUserAPC ((PAPCFUNC)abort_apc, handle, (ULONG_PTR)NULL);
+
+ CloseHandle (handle);
+}
+
+gboolean
+mono_threads_suspend_needs_abort_syscall (void)
+{
+ return TRUE;
+}
+
gboolean
mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
{
{
}
+void
+mono_threads_suspend_init_signals (void)
+{
+}
+
+gint
+mono_threads_suspend_search_alternative_signal (void)
+{
+ g_assert_not_reached ();
+}
+
+gint
+mono_threads_suspend_get_suspend_signal (void)
+{
+ return -1;
+}
+
+gint
+mono_threads_suspend_get_restart_signal (void)
+{
+ return -1;
+}
+
+gint
+mono_threads_suspend_get_abort_signal (void)
+{
+ return -1;
+}
+
#endif
#if defined (HOST_WIN32)
}
int
-mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize stack_size, MonoNativeThreadId *out_tid)
+mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid)
{
HANDLE result;
DWORD thread_id;
- result = CreateThread (NULL, stack_size, (LPTHREAD_START_ROUTINE) thread_fn, thread_data, 0, &thread_id);
+ result = CreateThread (NULL, stack_size ? *stack_size : 0, (LPTHREAD_START_ROUTINE) thread_fn, thread_data, 0, &thread_id);
if (!result)
return -1;
if (out_tid)
*out_tid = thread_id;
+ if (stack_size) {
+ // TOOD: Use VirtualQuery to get correct value
+ // http://stackoverflow.com/questions/2480095/thread-stack-size-on-windows-visual-c
+ *stack_size = 2 * 1024 * 1024;
+ }
+
return 0;
}