apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject [PATCH] WIN32 - fix apr_thread_join (PR: 28460)
Date Fri, 27 Aug 2004 09:44:01 GMT
Patch fixes the thread join for already finished thread.
Unlike Mark Khon's patch, this patch simply checks if the
thread has been closed.

Index: thread.c
===================================================================
RCS file: /home/cvspublic/apr/threadproc/win32/thread.c,v
retrieving revision 1.57
diff -u -r1.57 thread.c
--- thread.c	10 Jun 2004 10:57:25 -0000	1.57
+++ thread.c	27 Aug 2004 09:28:16 -0000
@@ -135,6 +135,7 @@
  #ifndef _WIN32_WCE
      if (thd->td) {
          CloseHandle(thd->td);
+        thd->td = NULL;
      }
      _endthreadex(0);
  #else
@@ -147,7 +148,12 @@
                                            apr_thread_t *thd)
  {
      apr_status_t rv;
-
+
+    if (!thd->td) {
+        /* The thead has already been closed */
+        *retval = thd->exitval;
+        return APR_SUCCESS;
+    }
      rv = WaitForSingleObject(thd->td, INFINITE);
      if ( rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
          *retval = thd->exitval;



Mime
View raw message