ruby-changes:50359
From: normal <ko1@a...>
Date: Mon, 19 Feb 2018 08:58:37 +0900 (JST)
Subject: [ruby-changes:50359] normal:r62475 (trunk): thread_pthread.c (rb_thread_create_mjit): set detach before create
normal 2018-02-19 08:58:30 +0900 (Mon, 19 Feb 2018) New Revision: 62475 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62475 Log: 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. Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 62474) +++ thread_pthread.c (revision 62475) @@ -1766,10 +1766,10 @@ rb_thread_create_mjit_thread(void (*chil https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1766 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 { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/