diff --git a/repos/libports/src/lib/libc/pthread.cc b/repos/libports/src/lib/libc/pthread.cc index 02161722c0..37b03c0e15 100644 --- a/repos/libports/src/lib/libc/pthread.cc +++ b/repos/libports/src/lib/libc/pthread.cc @@ -19,6 +19,9 @@ #include #include +/* Genode-internal includes */ +#include + /* libc includes */ #include #include @@ -588,13 +591,11 @@ extern "C" { /* * We create a pthread object associated to the main thread's Thread * object. We ensure the pthread object does never get deleted by - * allocating it in heap via new(). Otherwise, the static destruction - * of the pthread object would also destruct the 'Thread' of the main - * thread. + * allocating it as unmanaged_singleton. Otherwise, the static + * destruction of the pthread object would also destruct the 'Thread' + * of the main thread. */ - Libc::Allocator alloc { }; - static pthread *main = new (alloc) pthread(*Thread::myself()); - return main; + return unmanaged_singleton(*Thread::myself()); }