summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c7
1 files 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);
}