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.
This commit is contained in:
Christian Prochaska 2012-11-28 22:24:59 +01:00 committed by Norman Feske
parent b3815c95a7
commit 46a81ab890
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,6 @@
* under the terms of the GNU General Public License version 2.
*/
#include <base/sleep.h>
#include <base/thread.h>
@ -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();
}