From dd0d3032087734ae660fba5d2218c9458eb7a390 Mon Sep 17 00:00:00 2001 From: bje Date: Fri, 10 Jul 1998 13:06:05 +0000 Subject: 1998-07-10 Ben Elliston * exit2.c: New file; test pthread_exit() harder. --- tests/exit2.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/exit2.c (limited to 'tests/exit2.c') diff --git a/tests/exit2.c b/tests/exit2.c new file mode 100644 index 0000000..40f218b --- /dev/null +++ b/tests/exit2.c @@ -0,0 +1,32 @@ +/* + * Test for pthread_exit(). + * + * Depends on API functions: pthread_create(). + */ + +#include +#include + +void * +func(void * arg) +{ + printf("Hello world\n"); + pthread_exit(arg); +} + +int +main(int argc, char * argv[]) +{ + pthread_t id[2]; + int i; + + /* Create a few threads, make them say hello and then exit. */ + + for (i = 0; i < 4; i++) + { + pthread_create(&id, NULL, entry, (void *) i); + } + + /* Semantics should be the same as POSIX. Wait for the workers. */ + pthread_exit((void *) 0); +} -- cgit v1.2.3