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(..).

ref #1076
This commit is contained in:
Martin Stein 2014-03-06 13:39:08 +01:00 committed by Norman Feske
parent 52addb591b
commit e38060d81e
2 changed files with 9 additions and 7 deletions

View File

@ -74,7 +74,15 @@ void Thread_base::_thread_bootstrap()
void Thread_base::_init_platform_thread(Type type)
{
/* nothing platform specific to do if this is not a special thread */
if (type == NORMAL) { return; }
if (type == NORMAL)
{
/* create server object */
char buf[48];
name(buf, sizeof(buf));
Cpu_session * cpu = env()->cpu_session();
_thread_cap = cpu->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);

View File

@ -61,12 +61,6 @@ void Thread_base::_deinit_platform_thread()
void Thread_base::start()
{
/* create server object */
char buf[48];
name(buf, sizeof(buf));
Cpu_session * cpu = env()->cpu_session();
_thread_cap = cpu->create_thread(buf, (addr_t)&_context->utcb);
/* assign thread to protection domain */
env()->pd_session()->bind_thread(_thread_cap);