* threads.c (mono_thread_attach): Call DuplicateHandle on the thread handle on win32 to make
it a real thread handle.
svn path=/trunk/mono/; revision=38731
2005-01-11 Zoltan Varga <vargaz@freemail.hu>
+ * threads.c (mono_thread_attach): Call DuplicateHandle on the thread handle on win32 to make
+ it a real thread handle.
+
* domain-internals.h: Move exvar_offset from MonoJitInfo to
MonoJitExceptionInfo, since each catch clause needs its own variable.
tid=GetCurrentThreadId ();
+#ifdef PLATFORM_WIN32
+ /*
+ * The handle returned by GetCurrentThread () is a pseudo handle, so it can't be used to
+ * refer to the thread from other threads for things like aborting.
+ */
+ DuplicateHandle (GetCurrentProcess (), thread_handle, GetCurrentProcess (), &thread_handle,
+ THREAD_ALL_ACCESS, TRUE, 0);
+#endif
+
thread->handle=thread_handle;
thread->tid=tid;
thread->synch_lock=mono_object_new (domain, mono_defaults.object_class);