Author: dick
Date: 2007-11-20 15:24:04 -0500 (Tue, 20 Nov 2007)
New Revision: 90026

Modified:
   branches/mono-1-2-6/mono/mono/metadata/ChangeLog
   branches/mono-1-2-6/mono/mono/metadata/threads.c
Log:

2007-11-15  Dick Porter  <[EMAIL PROTECTED]>

        * threads.c (ves_icall_System_Threading_Thread_Join_internal):
        When joining a thread, it's the thread that's calling Join that
        gets WaitSleepJoin state not the target.  Fixes the standalone
        test case in bug 334740, and hopefully the whole bug too.



Modified: branches/mono-1-2-6/mono/mono/metadata/ChangeLog
===================================================================
--- branches/mono-1-2-6/mono/mono/metadata/ChangeLog    2007-11-20 20:17:55 UTC 
(rev 90025)
+++ branches/mono-1-2-6/mono/mono/metadata/ChangeLog    2007-11-20 20:24:04 UTC 
(rev 90026)
@@ -1,4 +1,10 @@
+2007-11-15  Dick Porter  <[EMAIL PROTECTED]>
 
+       * threads.c (ves_icall_System_Threading_Thread_Join_internal):
+       When joining a thread, it's the thread that's calling Join that
+       gets WaitSleepJoin state not the target.  Fixes the standalone
+       test case in bug 334740, and hopefully the whole bug too.
+
 Tue Nov 20 20:54:12 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
 
        * class.c: more interface implementations needed for the

Modified: branches/mono-1-2-6/mono/mono/metadata/threads.c
===================================================================
--- branches/mono-1-2-6/mono/mono/metadata/threads.c    2007-11-20 20:17:55 UTC 
(rev 90025)
+++ branches/mono-1-2-6/mono/mono/metadata/threads.c    2007-11-20 20:24:04 UTC 
(rev 90026)
@@ -1156,6 +1156,7 @@
 gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this,
                                                         int ms, HANDLE thread)
 {
+       MonoThread *cur_thread = mono_thread_current ();
        gboolean ret;
        
        MONO_ARCH_SAVE_REGS;
@@ -1170,8 +1171,6 @@
                mono_raise_exception (mono_get_exception_thread_state ("Thread 
has not been started."));
                return FALSE;
        }
-       
-       this->state |= ThreadState_WaitSleepJoin;
 
        LeaveCriticalSection (this->synch_cs);
 
@@ -1180,9 +1179,11 @@
        }
        THREAD_DEBUG (g_message ("%s: joining thread handle %p, %d ms", 
__func__, thread, ms));
        
+       mono_thread_set_state (cur_thread, ThreadState_WaitSleepJoin);
+
        ret=WaitForSingleObjectEx (thread, ms, TRUE);
 
-       mono_thread_clr_state (this, ThreadState_WaitSleepJoin);
+       mono_thread_clr_state (cur_thread, ThreadState_WaitSleepJoin);
        
        if(ret==WAIT_OBJECT_0) {
                THREAD_DEBUG (g_message ("%s: join successful", __func__));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to