From 872f824aaee53dda826bf7c6a07f9c137303f5a9 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 15 Mar 2024 12:57:09 +0100 Subject: [PATCH] better error message and don't use errno --- src/sched.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sched.c b/src/sched.c index 9b9c388..801a52f 100644 --- a/src/sched.c +++ b/src/sched.c @@ -10,18 +10,18 @@ int sched_init(int nthreads, int qlen, taskfunc f, void *closure) { int sched_spawn(taskfunc f, void *closure, struct scheduler *s) { pthread_t thread; - int errno; + int err; // Création d'un thread pour la tâche - if ((errno = pthread_create(&thread, NULL, (void *(*)(void *))f, closure)) != + if ((err = pthread_create(&thread, NULL, (void *(*)(void *))f, closure)) != 0) { fprintf(stderr, "pthread_create error %d\n", errno); return -1; } // Attend la fin du thread - if ((errno = pthread_join(thread, NULL)) != 0) { - fprintf(stderr, "error %d\n", errno); + if ((err = pthread_join(thread, NULL)) != 0) { + fprintf(stderr, "pthread_join error %d\n", errno); return -1; }