linux: destroy native CPU client after thread start

The native CPU client holds a capability reference and the reference
counter of the capability can reach its limit when many threads are
successively created and destroyed (destroyed by the Linux kernel).

Fixes #2886
This commit is contained in:
Christian Prochaska 2018-06-26 12:01:51 +02:00 committed by Norman Feske
parent 25b47758b7
commit 2f7e421eed

View File

@ -68,8 +68,10 @@ void Thread::_thread_start()
lx_sigaction(LX_SIGUSR1, empty_signal_handler, false);
/* inform core about the new thread and process ID of the new thread */
Linux_native_cpu_client native_cpu(thread->_cpu_session->native_cpu());
native_cpu.thread_id(thread->cap(), thread->native_thread().pid, thread->native_thread().tid);
{
Linux_native_cpu_client native_cpu(thread->_cpu_session->native_cpu());
native_cpu.thread_id(thread->cap(), thread->native_thread().pid, thread->native_thread().tid);
}
/* wakeup 'start' function */
startup_lock().unlock();