Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a TESH for the new sthread feature
[simgrid.git] / examples / sthread / pthread-mutex-simple.c
index abe582d..b59214f 100644 (file)
@@ -10,6 +10,7 @@ static void* thread1_fun(void* ignore)
   pthread_mutex_lock(&mutex);
   pthread_mutex_unlock(&mutex);
 
+  fprintf(stderr, "The first thread is terminating.\n");
   return NULL;
 }
 static void* thread2_fun(void* ignore)
@@ -17,23 +18,21 @@ static void* thread2_fun(void* ignore)
   pthread_mutex_lock(&mutex);
   pthread_mutex_unlock(&mutex);
 
+  fprintf(stderr, "The second thread is terminating.\n");
   return NULL;
 }
 
 int main(int argc, char* argv[])
 {
-  fprintf(stderr, "User main is starting\n");
-
   pthread_mutex_init(&mutex, NULL);
 
   pthread_t thread1, thread2;
   pthread_create(&thread1, NULL, thread1_fun, NULL);
-  fprintf(stderr, "here\n");
   pthread_create(&thread2, NULL, thread2_fun, NULL);
-  fprintf(stderr, "there\n");
+  fprintf(stderr, "All threads are started.\n");
   pthread_join(thread1, NULL);
   pthread_join(thread2, NULL);
 
-  fprintf(stderr, "User main is done\n");
+  fprintf(stderr, "User's main is terminating.\n");
   return 0;
 }