From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11563 Path: news.gmane.org!.POSTED!not-for-mail From: Jens Gustedt Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 2/8] consistently use the LOCK an UNLOCK macros Date: Tue, 20 Jun 2017 21:41:49 +0200 Message-ID: References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1498229277 17528 195.159.176.226 (23 Jun 2017 14:47:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Jun 2017 14:47:57 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11576-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jun 23 16:47:54 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dOPsF-0004Dq-PM for gllmg-musl@m.gmane.org; Fri, 23 Jun 2017 16:47:51 +0200 Original-Received: (qmail 25800 invoked by uid 550); 23 Jun 2017 14:47:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 25763 invoked from network); 23 Jun 2017 14:47:52 -0000 X-IronPort-AV: E=Sophos;i="5.39,378,1493676000"; d="scan'208";a="280371986" In-Reply-To: Resent-Date: Fri, 23 Jun 2017 16:47:40 +0200 Resent-From: Jens Gustedt Resent-Message-ID: <20170623164740.1f2629b9@inria.fr> Resent-To: musl@lists.openwall.com Xref: news.gmane.org gmane.linux.lib.musl.general:11563 Archived-At: 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 | 6 +++--- src/thread/pthread_detach.c | 2 +- src/thread/pthread_getschedparam.c | 4 ++-- src/thread/pthread_kill.c | 4 ++-- src/thread/pthread_setschedparam.c | 4 ++-- src/thread/pthread_setschedprio.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 49f2f729..ca5c6b90 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -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 diff --git a/src/thread/pthread_detach.c b/src/thread/pthread_detach.c index 818626ed..cf0397f7 100644 --- a/src/thread/pthread_detach.c +++ b/src/thread/pthread_detach.c @@ -9,7 +9,7 @@ static int __pthread_detach(pthread_t t) if (a_cas(t->exitlock, 0, -INT_MAX)) return __pthread_join(t, 0); t->detached = 2; - __unlock(t->exitlock); + UNLOCK(t->exitlock); return 0; } diff --git a/src/thread/pthread_getschedparam.c b/src/thread/pthread_getschedparam.c index 3053c186..a994b637 100644 --- a/src/thread/pthread_getschedparam.c +++ b/src/thread/pthread_getschedparam.c @@ -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; } diff --git a/src/thread/pthread_kill.c b/src/thread/pthread_kill.c index acdb1ea6..f0903420 100644 --- a/src/thread/pthread_kill.c +++ b/src/thread/pthread_kill.c @@ -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; } diff --git a/src/thread/pthread_setschedparam.c b/src/thread/pthread_setschedparam.c index c4738d64..9e2fa456 100644 --- a/src/thread/pthread_setschedparam.c +++ b/src/thread/pthread_setschedparam.c @@ -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; } diff --git a/src/thread/pthread_setschedprio.c b/src/thread/pthread_setschedprio.c index e0bdc03b..dc745b42 100644 --- a/src/thread/pthread_setschedprio.c +++ b/src/thread/pthread_setschedprio.c @@ -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; }