From e3743e2ffdef8246aff171309aa09b65a7ccebd8 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 13 Dec 1998 18:02:57 +0000 Subject: Update. 1998-12-13 Ulrich Drepper * Examples/ex3.c: Wait until all threads are started before searching for the number to avoid race condition on very fast systems. --- linuxthreads/Examples/ex3.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'linuxthreads/Examples/ex3.c') diff --git a/linuxthreads/Examples/ex3.c b/linuxthreads/Examples/ex3.c index 7557cc7983..8005200eff 100644 --- a/linuxthreads/Examples/ex3.c +++ b/linuxthreads/Examples/ex3.c @@ -19,6 +19,7 @@ void print_it(void *); pthread_t threads[NUM_THREADS]; pthread_mutex_t lock; int tries; +volatile int started; int main(int argc, char ** argv) { @@ -33,8 +34,8 @@ int main(int argc, char ** argv) pthread_mutex_init(&lock, NULL); /* Create the searching threads */ - for (i=0; i