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
|
* \brief pthread_create implementation
|
||||||
* \author Christian Prochaska
|
* \author Christian Prochaska
|
||||||
|
* \author Christian Helmuth
|
||||||
* \date 2012-03-12
|
* \date 2012-03-12
|
||||||
*
|
*
|
||||||
* Purpose of a single file for pthread_create is that other application may
|
* 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
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
|
#include <base/lock.h>
|
||||||
|
#include <util/string.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <libc/allocator.h>
|
#include <libc/allocator.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -23,6 +28,20 @@
|
||||||
#include <internal/pthread.h>
|
#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,
|
int Libc::pthread_create(pthread_t *thread,
|
||||||
void *(*start_routine) (void *), void *arg,
|
void *(*start_routine) (void *), void *arg,
|
||||||
size_t stack_size, char const * name,
|
size_t stack_size, char const * name,
|
||||||
|
@ -66,7 +85,7 @@ extern "C"
|
||||||
: Libc::Component::stack_size();
|
: Libc::Component::stack_size();
|
||||||
|
|
||||||
return Libc::pthread_create(thread, start_routine, arg, stack_size,
|
return Libc::pthread_create(thread, start_routine, arg, stack_size,
|
||||||
"pthread", nullptr,
|
pthread_name().string(), nullptr,
|
||||||
Genode::Affinity::Location());
|
Genode::Affinity::Location());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user