X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/58d501820579989d9072d04845b09b0c2d21d05e..c4830be809e3969945e79f543151a676bbc12a1f:/examples/sthread/pthread-mutex-simple.c diff --git a/examples/sthread/pthread-mutex-simple.c b/examples/sthread/pthread-mutex-simple.c index abe582d5f0..b59214f2a6 100644 --- a/examples/sthread/pthread-mutex-simple.c +++ b/examples/sthread/pthread-mutex-simple.c @@ -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; }