mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
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:
parent
ccba43574f
commit
f5fdcc8f1e
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user