Remove exceptions from Cpu_session interface

The 'Thread_creation_failed' error is now reflected as
'Thread::Start_result' return value. This change also removes the
use of 'Invalid_thread' within core as this exception is an alias
of Cpu_session::Thread_creation_failed.

Issue #5245
This commit is contained in:
Norman Feske
2024-06-17 18:19:07 +02:00
parent e7f564cd3b
commit d866b6b053
58 changed files with 562 additions and 371 deletions

View File

@ -52,7 +52,7 @@ class Core::Interrupt_handler : public Thread
static Foc::l4_cap_idx_t handler_cap()
{
static Interrupt_handler handler;
return handler._thread_cap.data()->kcap();
return handler.cap().data()->kcap();
}
};

View File

@ -140,12 +140,16 @@ Pager_capability Pager_entrypoint::manage(Pager_object &obj)
{
using namespace Foc;
Native_capability cap(_cap_factory.alloc(Thread::_thread_cap));
return _thread_cap.convert<Pager_capability>(
[&] (Thread_capability thread_cap) {
Native_capability cap(_cap_factory.alloc(thread_cap));
/* add server object to object pool */
obj.cap(cap);
insert(&obj);
/* add server object to object pool */
obj.cap(cap);
insert(&obj);
/* return capability that uses the object id as badge */
return reinterpret_cap_cast<Pager_object>(cap);
/* return capability that uses the object id as badge */
return reinterpret_cap_cast<Pager_object>(cap);
},
[&] (Cpu_session::Create_thread_error) { return Pager_capability(); });
}

View File

@ -86,7 +86,6 @@ bool Platform_pd::bind_thread(Platform_thread &thread)
return true;
}
error("thread alloc failed");
return false;
}

View File

@ -39,7 +39,7 @@ void Thread::_deinit_platform_thread()
void Thread::_init_platform_thread(size_t, Type) { }
void Thread::start()
Thread::Start_result Thread::start()
{
using namespace Foc;
@ -113,4 +113,6 @@ void Thread::start()
new (platform().core_mem_alloc()) Core_trace_source(Core::Trace::sources(),
*this, pt);
return Start_result::OK;
}