consistently use the LOCK an UNLOCK macros
authorJens Gustedt <Jens.Gustedt@inria.fr>
Wed, 3 Jan 2018 13:17:12 +0000 (14:17 +0100)
committerRich Felker <dalias@aerifal.cx>
Tue, 9 Jan 2018 18:14:49 +0000 (13:14 -0500)
In some places there has been a direct usage of the functions. Use the
macros consistently everywhere, such that it might be easier later on to
capture the fast path directly inside the macro and only have the call
overhead on the slow path.

src/thread/pthread_create.c
src/thread/pthread_detach.c
src/thread/pthread_getschedparam.c
src/thread/pthread_kill.c
src/thread/pthread_setschedparam.c
src/thread/pthread_setschedprio.c

index 6cbf85b..34cd993 100644 (file)
@@ -37,10 +37,10 @@ _Noreturn void __pthread_exit(void *result)
 
        __pthread_tsd_run_dtors();
 
-       __lock(self->exitlock);
+       LOCK(self->exitlock);
 
        /* Mark this thread dead before decrementing count */
-       __lock(self->killlock);
+       LOCK(self->killlock);
        self->dead = 1;
 
        /* Block all signals before decrementing the live thread count.
@@ -54,7 +54,7 @@ _Noreturn void __pthread_exit(void *result)
         * been blocked. This precludes observation of the thread id
         * as a live thread (with application code running in it) after
         * the thread was reported dead by ESRCH being returned. */
-       __unlock(self->killlock);
+       UNLOCK(self->killlock);
 
        /* It's impossible to determine whether this is "the last thread"
         * until performing the atomic decrement, since multiple threads
index d9c90d1..692bbaf 100644 (file)
@@ -9,7 +9,7 @@ static int __pthread_detach(pthread_t t)
        if (a_cas(t->exitlock, 0, INT_MIN + 1))
                return __pthread_join(t, 0);
        t->detached = 2;
-       __unlock(t->exitlock);
+       UNLOCK(t->exitlock);
        return 0;
 }
 
index 3053c18..a994b63 100644 (file)
@@ -3,7 +3,7 @@
 int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param)
 {
        int r;
-       __lock(t->killlock);
+       LOCK(t->killlock);
        if (t->dead) {
                r = ESRCH;
        } else {
@@ -12,6 +12,6 @@ int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param
                        *policy = __syscall(SYS_sched_getscheduler, t->tid);
                }
        }
-       __unlock(t->killlock);
+       UNLOCK(t->killlock);
        return r;
 }
index acdb1ea..f090342 100644 (file)
@@ -3,8 +3,8 @@
 int pthread_kill(pthread_t t, int sig)
 {
        int r;
-       __lock(t->killlock);
+       LOCK(t->killlock);
        r = t->dead ? ESRCH : -__syscall(SYS_tkill, t->tid, sig);
-       __unlock(t->killlock);
+       UNLOCK(t->killlock);
        return r;
 }
index c4738d6..9e2fa45 100644 (file)
@@ -3,8 +3,8 @@
 int pthread_setschedparam(pthread_t t, int policy, const struct sched_param *param)
 {
        int r;
-       __lock(t->killlock);
+       LOCK(t->killlock);
        r = t->dead ? ESRCH : -__syscall(SYS_sched_setscheduler, t->tid, policy, param);
-       __unlock(t->killlock);
+       UNLOCK(t->killlock);
        return r;
 }
index e0bdc03..dc745b4 100644 (file)
@@ -3,8 +3,8 @@
 int pthread_setschedprio(pthread_t t, int prio)
 {
        int r;
-       __lock(t->killlock);
+       LOCK(t->killlock);
        r = t->dead ? ESRCH : -__syscall(SYS_sched_setparam, t->tid, &prio);
-       __unlock(t->killlock);
+       UNLOCK(t->killlock);
        return r;
 }