summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrpj <rpj>1999-08-19 05:26:02 +0000
committerrpj <rpj>1999-08-19 05:26:02 +0000
commit5e87a0d9bdd4c2c2ab0e45a6379b4df0f1471ffa (patch)
treec8b65744680e1ca884470f2f345b929e2abc4ff8 /tests
parentb1972e47c0359b818522f6aa822f3457be938060 (diff)
1999-08-19 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* private.c (_pthread_threadStart): Return exit status from the application thread startup routine. - Milan Gardian <mg@tatramed.sk> 1999-08-18 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * exit.c (pthread_exit): Put status into pthread_t->exitStatus - John Bossom <john.Bossom@cognos.com> * private.c (_pthread_threadStart): Set pthread->exitStatus on exit of try{} block. - John Bossom <john.Bossom@cognos.com> * sync.c (pthread_join): use pthread_exitStatus value if the thread exit doesn't return a value (for Mingw32 CRTDLL which uses endthread instead of _endthreadex). - John Bossom <john.Bossom@cognos.com> Tue Aug 17 20:17:58 CDT 1999 Mumit Khan <khan@xraylith.wisc.edu> * create.c (pthread_create): Add CRTDLL suppport. * exit.c (pthread_exit): Likewise. * private.c (_pthread_threadStart): Likewise. (_pthread_threadDestroy): Likewise. * sync.c (pthread_join): Likewise. * tests/join1.c (main): Warn about partial support for CRTDLL. Tue Aug 17 20:00:08 1999 Mumit Khan <khan@xraylith.wisc.edu> * Makefile.in (LD): Delete entry point. * acconfig.h (STDCALL): Delete unused macro. * configure.in: Remove test for STDCALL. * config.h.in: Regenerate. * errno.c (_errno): Fix self type. * pthread.h (PT_STDCALL): Move from here to * implement.h (PT_STDCALL): here. (_pthread_threadStart): Fix prototype. * private.c (_pthread_threadStart): Likewise. 1999-08-14 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * exit.c (pthread_exit): Don't call pthread_self() but get thread handle directly from TSD for efficiency.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/Makefile3
-rw-r--r--tests/join1.c5
-rw-r--r--tests/join2.c37
4 files changed, 48 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index ac229c7..3d5163b 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+Aug 19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * join2.c: New test.
+
Wed Aug 12 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* Makefile (LIBS): Add -L.
diff --git a/tests/Makefile b/tests/Makefile
index 7c60452..60bd014 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -38,7 +38,7 @@ COPYFILES = $(HDR) $(LIB) $(DLL)
TESTS = mutex1 condvar1 condvar2 exit1 create1 equal1 \
exit2 exit3 \
- join1 mutex2 mutex3 \
+ join1 join2 mutex2 mutex3 \
count1 once1 tsd1 self1 self2 eyal1 \
condvar3 condvar4 condvar5 condvar6 \
errno1
@@ -60,6 +60,7 @@ equal1.pass: create1.pass
exit2.pass: create1.pass
exit3.pass: create1.pass
join1.pass: create1.pass
+join2.pass: create1.pass
count1.pass: join1.pass
once1.pass: create1.pass
tsd1.pass: join1.pass
diff --git a/tests/join1.c b/tests/join1.c
index f6240de..f206c0b 100644
--- a/tests/join1.c
+++ b/tests/join1.c
@@ -33,7 +33,12 @@ main(int argc, char * argv[])
for (i = 0; i < 4; i++)
{
assert(pthread_join(id[i], (void *) &result) == 0);
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
assert(result == i);
+#else
+# warning pthread_join not fully supported in this configuration.
+ assert(result == 0);
+#endif
}
/* Success. */
diff --git a/tests/join2.c b/tests/join2.c
new file mode 100644
index 0000000..281a0df
--- /dev/null
+++ b/tests/join2.c
@@ -0,0 +1,37 @@
+/*
+ * Test for pthread_join() returning return value from threads.
+ *
+ * Depends on API functions: pthread_create().
+ */
+
+#include "test.h"
+
+void *
+func(void * arg)
+{
+ Sleep(1000);
+ return arg;
+}
+
+int
+main(int argc, char * argv[])
+{
+ pthread_t id[4];
+ int i;
+ int result;
+
+ /* Create a few threads and then exit. */
+ for (i = 0; i < 4; i++)
+ {
+ assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ assert(pthread_join(id[i], (void *) &result) == 0);
+ assert(result == i);
+ }
+
+ /* Success. */
+ return 0;
+}