mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
pthread: don't destroy the pthread object for the main thread
The pthread object for the main thread initializes its 'Thread_base' base class part with a reference to the 'Thread_base' object of the Genode main thread. Therefore the pthread object for the main thread should never be destroyed, as this would also destroy the Genode 'Thread_base' object. Fixes #1760
This commit is contained in:
parent
be8f16ac3e
commit
97bbc8f965
@ -129,9 +129,16 @@ extern "C" {
|
||||
if (is_main && !strcmp(name, "main")) {
|
||||
/* create a pthread object containing copy of main Thread_base */
|
||||
static struct pthread_attr main_thread_attr;
|
||||
static struct pthread main(*myself, &main_thread_attr);
|
||||
static struct pthread *main = nullptr;
|
||||
if (!main) {
|
||||
/*
|
||||
* The pthread object does not get deleted, because this would
|
||||
* also delete the 'Thread_base' of the main thread.
|
||||
*/
|
||||
main = new (Genode::env()->heap()) struct pthread(*myself, &main_thread_attr);
|
||||
}
|
||||
|
||||
return &main;
|
||||
return main;
|
||||
}
|
||||
|
||||
PERR("pthread_self() called from alien thread named '%s'", name);
|
||||
|
Loading…
Reference in New Issue
Block a user