diff options
author | davidxu <davidxu@FreeBSD.org> | 2005-04-24 00:17:30 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2005-04-24 00:17:30 +0000 |
commit | 6149b9f287815806eafa12f8ff1b310ea904e25b (patch) | |
tree | ea0d6c60891c52cfea641643c8fdac247c1c26f9 /tools | |
parent | 72410b5004bf1a674fd4ad9dab6076d99d1ab9a5 (diff) | |
download | FreeBSD-src-6149b9f287815806eafa12f8ff1b310ea904e25b.zip FreeBSD-src-6149b9f287815806eafa12f8ff1b310ea904e25b.tar.gz |
Adjust code to be more reliable.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/tls/ttls4/ttls4.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tools/regression/tls/ttls4/ttls4.c b/tools/regression/tls/ttls4/ttls4.c index 9a1d43b..d55e51b 100644 --- a/tools/regression/tls/ttls4/ttls4.c +++ b/tools/regression/tls/ttls4/ttls4.c @@ -9,21 +9,17 @@ #include <stdio.h> #include <pthread.h> +#include <unistd.h> int __thread n; void *f1(void *arg) { - n = 1; - return (0); -} - -void *f2(void *arg) -{ if (n != 0) { printf("bug, n == %d \n", n); exit(1); } + n = 1; return (0); } @@ -32,11 +28,13 @@ int main() pthread_t td; int i; - pthread_create(&td, NULL, f1, NULL); - pthread_join(td, NULL); for (i = 0; i < 1000; ++i) { - pthread_create(&td, NULL, f2, NULL); - pthread_yield(); + pthread_create(&td, NULL, f1, NULL); + pthread_join(td, NULL); + } + sleep(2); + for (i = 0; i < 1000; ++i) { + pthread_create(&td, NULL, f1, NULL); pthread_join(td, NULL); } return (0); |