diff options
Diffstat (limited to 'pthread1.c')
-rw-r--r-- | pthread1.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,9 +1,9 @@ /* extreme case */ -#include <stdlib.h> -#include <stdio.h> -#include <pthread.h> -#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <pthread.h> +#include <unistd.h> int left = 500, right = 500; pthread_mutex_t lock, cond_lock; @@ -24,11 +24,11 @@ void *leftf(void *args) struct timespec ts; gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec + 1; - ts.tv_nsec = 0; + ts.tv_nsec = 0; pthread_mutex_lock(&cond_lock); pthread_cond_timedwait(&cond, &cond_lock, &ts); - pthread_mutex_unlock(&cond_lock); + pthread_mutex_unlock(&cond_lock); pthread_mutex_lock(&lock); printf("Now running left\n"); |