From ac6fb3cf63e57894f8d762f6c767c713015a8dee Mon Sep 17 00:00:00 2001 From: Gentoo Date: Thu, 27 Aug 2020 10:15:32 +1000 Subject: more shortening --- main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 44413a6..5c997e0 100644 --- a/main.c +++ b/main.c @@ -8,15 +8,14 @@ int sortMe[] = {9,8,7,6,5,4,3,2,1,0,22,2,39,88,56,4,42,2,5}; int result[NUM_THREADS]; pthread_mutex_t lock; -int counter = 0; +int counter; void *sleepMe(int64_t *p) { - int n = *p; - usleep(n*500);//*200 will do, but *500 is needed to reliably attain a correct order for numbers only 1 apart + usleep((*p)*500);//*200 will do, but *500 is needed to reliably attain a correct order for numbers only 1 apart pthread_mutex_lock(&lock); - result[counter++] = n; + result[counter++] = *p; pthread_mutex_unlock(&lock); } -- cgit v1.2.3