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/ChangeLog | 6 ++++++ linuxthreads/Examples/ex3.c | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'linuxthreads') diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index a6913e9d47..a5d82a43a7 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,9 @@ +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. + 1998-12-08 Andreas Jaeger * sysdeps/pthread/pthread.h: Remove __pthread_setcanceltype 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