From 46a81ab8907b7c3bfe1040e4fa00860ed0eca72d Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Wed, 28 Nov 2012 22:24:59 +0100 Subject: [PATCH] foc: don't call 'sleep_forever()' on thread exit The generic 'sleep_forever()' function creates an Ipc_server object which might not get cleaned up correctly when the thread gets destroyed and unneeded capability references could remain and drain the capability index allocator. With this patch a lock gets used on thread exit instead of calling 'sleep_forever()'. Fixes #538. --- base-foc/src/base/thread/thread_bootstrap.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base-foc/src/base/thread/thread_bootstrap.cc b/base-foc/src/base/thread/thread_bootstrap.cc index f2997eb90..c7574ae42 100644 --- a/base-foc/src/base/thread/thread_bootstrap.cc +++ b/base-foc/src/base/thread/thread_bootstrap.cc @@ -11,7 +11,6 @@ * under the terms of the GNU General Public License version 2. */ -#include #include @@ -25,7 +24,8 @@ void Genode::Thread_base::_thread_start() Thread_base::myself()->_thread_bootstrap(); Thread_base::myself()->entry(); Thread_base::myself()->_join_lock.unlock(); - sleep_forever(); + Lock sleep_forever_lock(Lock::LOCKED); + sleep_forever_lock.lock(); }