about summary refs log tree commit diff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-02-22 02:56:10 -0500
committerRich Felker <dalias@aerifal.cx>2019-02-22 03:25:39 -0500
commitba18c1ecc6a18203ad8496791154af86f706f632 (patch)
treed1e407e0b4f3fbe9e4463e66c960473112159981 /src/thread
parent7865d569de7b29dd90b94b5680ec7a2a86ed27af (diff)
downloadmusl-ba18c1ecc6a18203ad8496791154af86f706f632.tar.gz
musl-ba18c1ecc6a18203ad8496791154af86f706f632.tar.xz
musl-ba18c1ecc6a18203ad8496791154af86f706f632.zip
add membarrier syscall wrapper, refactor dynamic tls install to use it
the motivation for this change is twofold. first, it gets the fallback
logic out of the dynamic linker, improving code readability and
organization. second, it provides application code that wants to use
the membarrier syscall, which depends on preregistration of intent
before the process becomes multithreaded unless unbounded latency is
acceptable, with a symbol that, when linked, ensures that this
registration happens.
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/pthread_create.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 54c03554..7d4dc2ed 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -15,7 +15,7 @@ weak_alias(dummy_0, __release_ptc);
 weak_alias(dummy_0, __pthread_tsd_run_dtors);
 weak_alias(dummy_0, __do_orphaned_stdio_locks);
 weak_alias(dummy_0, __dl_thread_cleanup);
-weak_alias(dummy_0, __dl_prepare_for_threads);
+weak_alias(dummy_0, __membarrier_init);
 
 static int tl_lock_count;
 static int tl_lock_waiters;
@@ -246,7 +246,7 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
 		init_file_lock(__stderr_used);
 		__syscall(SYS_rt_sigprocmask, SIG_UNBLOCK, SIGPT_SET, 0, _NSIG/8);
 		self->tsd = (void **)__pthread_tsd_main;
-		__dl_prepare_for_threads();
+		__membarrier_init();
 		libc.threaded = 1;
 	}
 	if (attrp && !c11) attr = *attrp;