2004-07-22 Dick Porter <dick@ximian.com>
authorDick Porter <dick@acm.org>
Thu, 22 Jul 2004 19:28:43 +0000 (19:28 -0000)
committerDick Porter <dick@acm.org>
Thu, 22 Jul 2004 19:28:43 +0000 (19:28 -0000)
* timed-thread.c:
* threads.c: Move the destruction of the internal thread data to
after the thread has been joined.  Fixes bug 61418.

svn path=/branches/mono-1-0/mono/; revision=31387

mono/io-layer/ChangeLog
mono/io-layer/threads.c
mono/io-layer/timed-thread.c

index ef6a745360055f556124741150a4d4226da22407..fec9ca9fbe05d151ef388bf51eeb62058abbda0d 100644 (file)
@@ -1,3 +1,9 @@
+2004-07-22  Dick Porter  <dick@ximian.com>
+
+       * timed-thread.c: 
+       * threads.c: Move the destruction of the internal thread data to
+       after the thread has been joined.  Fixes bug 61418.
+
 2004-07-14  Dick Porter  <dick@ximian.com>
 
        * wait.c (test_and_own): When not waiting for all handles to
index b9ddc6aa3dc269737ebc7d15b1d0730872af3c03..31c1176a12c50b211a050bfb036fdbfcab095cb8 100644 (file)
@@ -99,9 +99,7 @@ static void thread_close_private (gpointer handle)
                  thread_handle->thread->id);
 #endif
 
-       if(thread_handle->thread!=NULL) {
-               _wapi_timed_thread_destroy (thread_handle->thread);
-       }
+       thread_handle->thread=NULL;
 }
 
 static void thread_own (gpointer handle)
@@ -628,6 +626,10 @@ guint32 ResumeThread(gpointer handle)
                return(0xFFFFFFFF);
        }
 
+       if (thread_private_handle->thread == NULL) {
+               return(0xFFFFFFFF);
+       }
+
 #ifdef WITH_INCLUDED_LIBGC
        if (thread_private_handle->thread->suspend_count <= 1)
                _wapi_timed_thread_resume (thread_private_handle->thread);
@@ -670,6 +672,10 @@ guint32 SuspendThread(gpointer handle)
                return(0xFFFFFFFF);
        }
 
+       if (thread_private_handle->thread == NULL) {
+               return(0xFFFFFFFF);
+       }
+
        if (!thread_private_handle->thread->suspend_count) {
                if (handle == current)
                        _wapi_timed_thread_suspend (thread_private_handle->thread);
index c0d737862a27678487afdd8a01ea7cccabcdbce5..6599e0660f307150c3d0359bd34fce0f7687a4b6 100644 (file)
@@ -254,6 +254,8 @@ int _wapi_timed_thread_join(TimedThread *thread, struct timespec *timeout,
                if(exitstatus!=NULL) {
                        *exitstatus = thread->exitstatus;
                }
+
+               _wapi_timed_thread_destroy (thread);
        }
        return(result);
 }