From 2ef097640758653a0e9d63e90a4aac329cd86368 Mon Sep 17 00:00:00 2001 From: rpj Date: Mon, 22 Feb 1999 02:54:12 +0000 Subject: 1999-02-23 Ross Johnson * Makefile: Some refinement. * *.c: More exhaustive checking through assertions; clean up; add some more tests. --- tests/create1.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'tests/create1.c') diff --git a/tests/create1.c b/tests/create1.c index 2741401..192e52d 100644 --- a/tests/create1.c +++ b/tests/create1.c @@ -1,9 +1,19 @@ -#include -#include -#include +/* + * create1.c + * + * Description: + * Create a thread and check that it ran. + * + * Depends on API functions: None. + */ + +#include "test.h" + +static int washere = 0; void * func(void * arg) { + washere = 1; return 0; } @@ -11,14 +21,14 @@ int main() { pthread_t t; - if (pthread_create(&t, NULL, func, NULL) != 0) - { - return 1; - } + + assert(pthread_create(&t, NULL, func, NULL) == 0); /* A dirty hack, but we cannot rely on pthread_join in this primitive test. */ - Sleep(5000); + Sleep(2000); + + assert(washere == 1); return 0; } -- cgit v1.2.3