summary refs log tree commit diff
path: root/pkgs/os-specific/linux/musl/0003-fix-namespace-violation-for-c11-mutex-functions.patch
blob: 783873732afdb1ae41485aa6f9a51ae8a93efac5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 2de29bc994029b903a366b8a4a9f8c3c3ee2be90 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 4 Sep 2018 22:56:57 -0400
Subject: [PATCH 3/3] fix namespace violation for c11 mutex functions

__pthread_mutex_timedlock is used to implement c11 mutex functions,
and therefore cannot call pthread_mutex_trylock by name.
---
 src/thread/pthread_mutex_timedlock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/thread/pthread_mutex_timedlock.c b/src/thread/pthread_mutex_timedlock.c
index f91f4a61..d2bd1960 100644
--- a/src/thread/pthread_mutex_timedlock.c
+++ b/src/thread/pthread_mutex_timedlock.c
@@ -1,5 +1,7 @@
 #include "pthread_impl.h"
 
+int __pthread_mutex_trylock(pthread_mutex_t *);
+
 int __pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec *restrict at)
 {
 	if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL
@@ -15,7 +17,7 @@ int __pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec
 	int spins = 100;
 	while (spins-- && m->_m_lock && !m->_m_waiters) a_spin();
 
-	while ((r=pthread_mutex_trylock(m)) == EBUSY) {
+	while ((r=__pthread_mutex_trylock(m)) == EBUSY) {
 		if (!(r=m->_m_lock) || ((r&0x40000000) && (type&4)))
 			continue;
 		if ((type&3) == PTHREAD_MUTEX_ERRORCHECK
-- 
2.19.0