mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
libc: append serial number to pthread name
... in pthread_create() Issue #3550
This commit is contained in:
parent
3d4bed3374
commit
6aebd5dd95
@ -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 <base/lock.h>
|
||||
#include <util/string.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <libc/allocator.h>
|
||||
#include <errno.h>
|
||||
@ -23,6 +28,20 @@
|
||||
#include <internal/pthread.h>
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user