Staticify some more.
[TD_SE.git] / semaphore / semaphore.c
index 28eadbabae4f08ce631f99bd8250c09bf2c97933..53526d6fd6f37e2ddd3949e73c40fa67cb509e8c 100644 (file)
@@ -4,7 +4,7 @@
 
 #define val 1
 sem_t mutex;                   // sémaphore
-int var_glob = 0;
+static int var_glob = 0;
 
 void *increment(void *);
 void *decrement(void *);
@@ -21,7 +21,7 @@ int main()
        // attendre la fin des threads
        pthread_join(threadA, NULL);
        pthread_join(threadB, NULL);
-       printf("ici main, fin threads : var_glob =%d \n", var_glob);
+       printf("ici main, fin threads : var_glob = %d\n", var_glob);
        return 0;
 }
 
@@ -31,7 +31,7 @@ void *decrement(void *nothing)
        var_glob = var_glob - 1;
        printf("ici sc de decrement: var_glob= %d\n", var_glob);
        sem_post(&mutex);
-       return (NULL);
+       return NULL;
 }
 
 void *increment(void *nothing)
@@ -40,5 +40,5 @@ void *increment(void *nothing)
        var_glob = var_glob + 1;
        printf("ici sc de increment: var_glob= %d\n", var_glob);
        sem_post(&mutex);
-       return (NULL);
+       return NULL;
 }