about summary refs log tree commit diff
path: root/src/thread/pthread_detach.c
diff options
context:
space:
mode:
authorJens Gustedt <Jens.Gustedt@inria.fr>2014-09-01 00:46:23 +0200
committerRich Felker <dalias@aerifal.cx>2014-09-06 18:11:24 -0400
commitdf7d0dfb9c686df31149d09008ba92834bed9803 (patch)
tree758743956de08b94514757bda68a628751d0f533 /src/thread/pthread_detach.c
parent6eb19505bc10eb7964c4863e53ef1028944044f2 (diff)
downloadmusl-df7d0dfb9c686df31149d09008ba92834bed9803.tar.gz
musl-df7d0dfb9c686df31149d09008ba92834bed9803.tar.xz
musl-df7d0dfb9c686df31149d09008ba92834bed9803.zip
use weak symbols for the POSIX functions that will be used by C threads
The intent of this is to avoid name space pollution of the C threads
implementation.

This has two sides to it. First we have to provide symbols that wouldn't
pollute the name space for the C threads implementation. Second we have
to clean up some internal uses of POSIX functions such that they don't
implicitly drag in such symbols.
Diffstat (limited to 'src/thread/pthread_detach.c')
-rw-r--r--src/thread/pthread_detach.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/thread/pthread_detach.c b/src/thread/pthread_detach.c
index 651c38eb..4e454634 100644
--- a/src/thread/pthread_detach.c
+++ b/src/thread/pthread_detach.c
@@ -1,11 +1,15 @@
 #include "pthread_impl.h"
 
-int pthread_detach(pthread_t t)
+int __pthread_join(pthread_t, void **);
+
+int __pthread_detach(pthread_t t)
 {
 	/* Cannot detach a thread that's already exiting */
 	if (a_swap(t->exitlock, 1))
-		return pthread_join(t, 0);
+		return __pthread_join(t, 0);
 	t->detached = 2;
 	__unlock(t->exitlock);
 	return 0;
 }
+
+weak_alias(__pthread_detach, pthread_detach);