Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Please valgrind.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 30 Jun 2022 08:32:31 +0000 (10:32 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 30 Jun 2022 08:38:23 +0000 (10:38 +0200)
examples/sthread/pthread-mutex-simple.c
examples/sthread/sthread-mutex-simple.c

index d46d75a..d97bfe8 100644 (file)
@@ -27,6 +27,8 @@ int main(int argc, char* argv[])
   pthread_join(thread1, NULL);
   pthread_join(thread2, NULL);
 
+  pthread_mutex_destroy(&mutex);
+
   fprintf(stderr, "User's main is terminating.\n");
   return 0;
 }
index 3ab8267..c0f48f6 100644 (file)
@@ -23,7 +23,9 @@ int main(int argc, char* argv[])
   sthread_create(&thread2, NULL, thread_fun, NULL);
   sthread_join(thread1, NULL);
   sthread_join(thread2, NULL);
-  fprintf(stderr, "done\n");
 
+  sthread_mutex_destroy(&mutex);
+
+  fprintf(stderr, "done\n");
   return 0;
 }