diff --git a/repos/libports/src/lib/libc/pthread_create.cc b/repos/libports/src/lib/libc/pthread_create.cc index 97e09597f..3a764b852 100644 --- a/repos/libports/src/lib/libc/pthread_create.cc +++ b/repos/libports/src/lib/libc/pthread_create.cc @@ -1,6 +1,7 @@ /* * \brief pthread_create implementation * \author Christian Prochaska + * \author Christian Helmuth * \date 2012-03-12 * * Purpose of a single file for pthread_create is that other application may @@ -8,12 +9,16 @@ */ /* - * Copyright (C) 2012-2017 Genode Labs GmbH + * Copyright (C) 2012-2020 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. */ +/* Genode includes */ +#include +#include + /* libc includes */ #include #include @@ -23,6 +28,20 @@ #include +static Genode::String<32> pthread_name() +{ + static Genode::Lock mutex; + + static unsigned id = 0; + + Genode::Lock::Guard guard(mutex); + + ++id; + + return { "pthread.", id }; +} + + int Libc::pthread_create(pthread_t *thread, void *(*start_routine) (void *), void *arg, size_t stack_size, char const * name, @@ -66,7 +85,7 @@ extern "C" : Libc::Component::stack_size(); return Libc::pthread_create(thread, start_routine, arg, stack_size, - "pthread", nullptr, + pthread_name().string(), nullptr, Genode::Affinity::Location()); } }