summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-18 23:58:30 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-18 23:58:30 (GMT)
commit7a8460ed5a766cad8c95e209c888f0c48adb1b2a (patch)
treedd9cf5e2bf984c50952a14aadd29282d5f9d25ed /thread_pthread.c
parent1ad2db3894e9f8fa43a891215d841c8f8ba3aeff (diff)
thread_pthread.c (rb_thread_create_mjit): set detach before create
This should be slightly cheaper on NPTL as it does not rely on atomics to set pd->joinid. We already use pthread_attr_setdetachstate, so it won't introduce new problems by using a function we did not use before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 7268618..db304ba 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1766,10 +1766,10 @@ rb_thread_create_mjit_thread(void (*child_hook)(void), void (*worker_func)(void)
pthread_atfork(NULL, NULL, child_hook);
if (pthread_attr_init(&attr) == 0
+ /* jit_worker thread is not to be joined */
+ && pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0
&& pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) == 0
&& pthread_create(&worker_pid, &attr, mjit_worker, (void *)worker_func) == 0) {
- /* jit_worker thread is not to be joined */
- pthread_detach(worker_pid);
return TRUE;
}
else {