From: Arnaud Giersch Date: Tue, 28 Jun 2022 09:40:37 +0000 (+0200) Subject: No need to duplicate functions. X-Git-Tag: v3.32~178^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b6ae40f39eb0516dc02697c90b3eaeb9bbc71367 No need to duplicate functions. --- diff --git a/examples/sthread/pthread-mutex-simple.c b/examples/sthread/pthread-mutex-simple.c index f0e29a6e62..3d9e995a2f 100644 --- a/examples/sthread/pthread-mutex-simple.c +++ b/examples/sthread/pthread-mutex-simple.c @@ -5,14 +5,7 @@ pthread_mutex_t mutex; -static void* thread1_fun(void* ignore) -{ - pthread_mutex_lock(&mutex); - pthread_mutex_unlock(&mutex); - - return NULL; -} -static void* thread2_fun(void* ignore) +static void* thread_fun(void* ignore) { pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex); @@ -28,9 +21,9 @@ int main(int argc, char* argv[]) pthread_t thread1; pthread_t thread2; - pthread_create(&thread1, NULL, thread1_fun, NULL); + pthread_create(&thread1, NULL, thread_fun, NULL); fprintf(stderr, "here\n"); - pthread_create(&thread2, NULL, thread2_fun, NULL); + pthread_create(&thread2, NULL, thread_fun, NULL); fprintf(stderr, "there\n"); pthread_join(thread1, NULL); pthread_join(thread2, NULL); diff --git a/examples/sthread/sthread-mutex-simple.c b/examples/sthread/sthread-mutex-simple.c index 45b6e513ef..3ab82670c8 100644 --- a/examples/sthread/sthread-mutex-simple.c +++ b/examples/sthread/sthread-mutex-simple.c @@ -5,14 +5,7 @@ sthread_mutex_t mutex; -static void* thread1_fun(void* ignore) -{ - sthread_mutex_lock(&mutex); - sthread_mutex_unlock(&mutex); - - return NULL; -} -static void* thread2_fun(void* ignore) +static void* thread_fun(void* ignore) { sthread_mutex_lock(&mutex); sthread_mutex_unlock(&mutex); @@ -26,8 +19,8 @@ int main(int argc, char* argv[]) sthread_t thread1; sthread_t thread2; - sthread_create(&thread1, NULL, thread1_fun, NULL); - sthread_create(&thread2, NULL, thread2_fun, NULL); + sthread_create(&thread1, NULL, thread_fun, NULL); + sthread_create(&thread2, NULL, thread_fun, NULL); sthread_join(thread1, NULL); sthread_join(thread2, NULL); fprintf(stderr, "done\n");