summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2005-05-18 14:35:16 +0000
committerrpj <rpj>2005-05-18 14:35:16 +0000
commit2f7259b53b446762a1178150b0762c734b85c206 (patch)
tree517e8077e3f4689d2ac331d7000757994cebfd2b
parent2531397c796d14f5fb934ae3fcf3c5327bd41bc9 (diff)
''
-rw-r--r--ANNOUNCE2
-rw-r--r--NEWS4
-rw-r--r--pthread.h4
-rw-r--r--pthread_win32_attach_detach_np.c7
-rw-r--r--ptw32_threadDestroy.c11
-rw-r--r--tests/cancel9.c2
-rw-r--r--tests/detach1.c19
7 files changed, 29 insertions, 20 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index 4c2eea4..bf92d4d 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,4 +1,4 @@
- PTHREADS-WIN32 RELEASE 1.9.0 (2005-05-09)
+ PTHREADS-WIN32 RELEASE 1.10.0 (2005-05-19)
-----------------------------------------
Web Site: http://sources.redhat.com/pthreads-win32/
FTP Site: ftp://sources.redhat.com/pub/pthreads-win32
diff --git a/NEWS b/NEWS
index 1dcc54d..93f38e5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,11 @@
RELEASE 1.10.0
-------------
-(Not released yet)
+(2005-05-19)
Bugs fixed
----------
-* pthread_detach() now reclaims remaining thread resources when called after
+* pthread_detach() now reclaims remaining thread resources if called after
the target thread has terminated. Previously, this routine did nothing in
this case.
diff --git a/pthread.h b/pthread.h
index 600695a..cbd1b83 100644
--- a/pthread.h
+++ b/pthread.h
@@ -37,8 +37,8 @@
* See the README file for an explanation of the pthreads-win32 version
* numbering scheme and how the DLL is named etc.
*/
-#define PTW32_VERSION 1,9,0,0
-#define PTW32_VERSION_STRING "1, 9, 0, 0\0"
+#define PTW32_VERSION 1,10,0,0
+#define PTW32_VERSION_STRING "1, 10, 0, 0\0"
/* There are three implementations of cancel cleanup.
* Note that pthread.h is included in both application
diff --git a/pthread_win32_attach_detach_np.c b/pthread_win32_attach_detach_np.c
index d839c70..2b99d53 100644
--- a/pthread_win32_attach_detach_np.c
+++ b/pthread_win32_attach_detach_np.c
@@ -263,8 +263,6 @@ pthread_win32_thread_detach_np ()
if (sp != NULL) // otherwise Win32 thread with no implicit POSIX handle.
{
- HANDLE threadH = sp->threadH;
-
ptw32_callUserDestroyRoutines (sp->ptHandle);
(void) pthread_mutex_lock (&sp->cancelLock);
@@ -279,11 +277,6 @@ pthread_win32_thread_detach_np ()
{
ptw32_threadDestroy (sp->ptHandle);
- if (threadH != 0)
- {
- CloseHandle (threadH);
- }
-
TlsSetValue (ptw32_selfThreadKey->key, NULL);
}
}
diff --git a/ptw32_threadDestroy.c b/ptw32_threadDestroy.c
index aa95e2c..eb9abfc 100644
--- a/ptw32_threadDestroy.c
+++ b/ptw32_threadDestroy.c
@@ -66,6 +66,17 @@ ptw32_threadDestroy (pthread_t thread)
(void) pthread_mutex_destroy(&threadCopy.cancelLock);
(void) pthread_mutex_destroy(&threadCopy.threadLock);
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__)
+ /*
+ * See documentation for endthread vs endthreadex.
+ */
+ if (threadCopy.threadH != 0)
+ {
+ CloseHandle (threadCopy.threadH);
+ }
+#endif
+
}
} /* ptw32_threadDestroy */
diff --git a/tests/cancel9.c b/tests/cancel9.c
index efa8ef2..b009161 100644
--- a/tests/cancel9.c
+++ b/tests/cancel9.c
@@ -97,7 +97,7 @@ test_udp (void *arg)
}
UDPSocket = socket (AF_INET, SOCK_DGRAM, 0);
- if (UDPSocket == -1)
+ if ((int)UDPSocket == -1)
{
printf ("Server: socket ERROR \n");
exit (-1);
diff --git a/tests/detach1.c b/tests/detach1.c
index b0835c5..165c8c1 100644
--- a/tests/detach1.c
+++ b/tests/detach1.c
@@ -38,12 +38,17 @@
#include "test.h"
+
+enum {
+ NUMTHREADS = 100
+};
+
void *
func(void * arg)
{
int i = (int) arg;
- Sleep(i * 100);
+ Sleep(i * 10);
pthread_exit(arg);
@@ -54,31 +59,31 @@ func(void * arg)
int
main(int argc, char * argv[])
{
- pthread_t id[4];
+ pthread_t id[NUMTHREADS];
int i;
/* Create a few threads and then exit. */
- for (i = 0; i < 4; i++)
+ for (i = 0; i < NUMTHREADS; i++)
{
assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
}
/* Some threads will finish before they are detached, some after. */
- Sleep(2 * 100 + 50);
+ Sleep(NUMTHREADS/2 * 10 + 50);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < NUMTHREADS; i++)
{
assert(pthread_detach(id[i]) == 0);
}
- Sleep(6 * 100);
+ Sleep(NUMTHREADS * 10 + 100);
/*
* Check that all threads are now invalid.
* This relies on unique thread IDs - e.g. works with
* pthreads-w32 or Solaris, but may not work for Linux, BSD etc.
*/
- for (i = 0; i < 4; i++)
+ for (i = 0; i < NUMTHREADS; i++)
{
assert(pthread_kill(id[i], 0) == ESRCH);
}