hw: get a thread cap in Thread_base constructor

Previously this was not done before Thread_base::start(..) in
base-hw as it was not needed to have a valid cap that early. However,
when changing the affinity of a thread we need the cap to be valid
before Thread_base::start(..).

fix #1151
This commit is contained in:
Martin Stein 2014-05-21 17:59:12 +02:00 committed by Norman Feske
parent ccba43574f
commit f5fdcc8f1e
1 changed files with 8 additions and 9 deletions

View File

@ -38,8 +38,15 @@ Native_utcb * main_thread_utcb() { return UTCB_MAIN_THREAD; }
void Thread_base::_init_platform_thread(Type type)
{
if (type == NORMAL) { return; }
if (!_cpu_session) { _cpu_session = env()->cpu_session(); }
if (type == NORMAL) {
/* create server object */
char buf[48];
name(buf, sizeof(buf));
_thread_cap = _cpu_session->create_thread(buf, (addr_t)&_context->utcb);
return;
}
/* if we got reinitialized we have to get rid of the old UTCB */
size_t const utcb_size = sizeof(Native_utcb);
addr_t const context_area = Native_config::context_area_virtual_base();
@ -81,14 +88,6 @@ void Thread_base::_deinit_platform_thread()
void Thread_base::start()
{
if (!_cpu_session)
_cpu_session = env()->cpu_session();
/* create server object */
char buf[48];
name(buf, sizeof(buf));
_thread_cap = _cpu_session->create_thread(buf, (addr_t)&_context->utcb);
/* assign thread to protection domain */
env()->pd_session()->bind_thread(_thread_cap);