summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrpj <rpj>2005-05-18 14:34:18 +0000
committerrpj <rpj>2005-05-18 14:34:18 +0000
commit70fb72bb490c66f06cdab08ad656c4ce52c71448 (patch)
tree513aa651f6589c9c3d30dde2d6c0c958c9339d0b /tests
parenta10f66e68253f8296ea624ebc6b55cd75cd0ba79 (diff)
''
Diffstat (limited to 'tests')
-rw-r--r--tests/Bmakefile2
-rw-r--r--tests/cancel9.c2
-rw-r--r--tests/detach1.c19
3 files changed, 14 insertions, 9 deletions
diff --git a/tests/Bmakefile b/tests/Bmakefile
index 682e956..b56c18f 100644
--- a/tests/Bmakefile
+++ b/tests/Bmakefile
@@ -63,7 +63,7 @@ BCXFLAGS = -D__CLEANUP_C
CPLIB = $(BCLIB)
CPDLL = $(BCDLL)
-CFLAGS= -q $(OPTIM) -w -tWC -tWM -w-aus -w-asc -w-par
+CFLAGS= -q $(OPTIM) /D_WIN32_WINNT=0x400 -w -tWC -tWM -4 -w-aus -w-asc -w-par
LFLAGS=
INCLUDES=-I.
BUILD_DIR=..
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);
}