mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Posix port - set name for threads (#950)
Co-authored-by: jasonpcarroll <23126711+jasonpcarroll@users.noreply.github.com>
This commit is contained in:
parent
52ab3d0f22
commit
e6f6d0ecf4
20
portable/ThirdParty/GCC/Posix/port.c
vendored
20
portable/ThirdParty/GCC/Posix/port.c
vendored
|
@ -51,6 +51,10 @@
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
#include "portmacro.h"
|
#include "portmacro.h"
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#define __USE_GNU
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -134,6 +138,16 @@ void prvFatalError( const char * pcCall,
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvPortSetCurrentThreadName(char * pxThreadName)
|
||||||
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
pthread_setname_np(pxThreadName);
|
||||||
|
#else
|
||||||
|
pthread_setname_np(pthread_self(), pxThreadName);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See header file for description.
|
* See header file for description.
|
||||||
*/
|
*/
|
||||||
|
@ -224,6 +238,7 @@ BaseType_t xPortStartScheduler( void )
|
||||||
const ListItem_t * pxEndMarker;
|
const ListItem_t * pxEndMarker;
|
||||||
|
|
||||||
hMainThread = pthread_self();
|
hMainThread = pthread_self();
|
||||||
|
prvPortSetCurrentThreadName("Scheduler");
|
||||||
|
|
||||||
/* Start the timer that generates the tick ISR(SIGALRM).
|
/* Start the timer that generates the tick ISR(SIGALRM).
|
||||||
* Interrupts are disabled here already. */
|
* Interrupts are disabled here already. */
|
||||||
|
@ -383,6 +398,8 @@ static void * prvTimerTickHandler( void * arg )
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
|
|
||||||
|
prvPortSetCurrentThreadName("Scheduler timer");
|
||||||
|
|
||||||
while( xTimerTickThreadShouldRun )
|
while( xTimerTickThreadShouldRun )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -493,6 +510,9 @@ static void * prvWaitForStart( void * pvParams )
|
||||||
uxCriticalNesting = 0;
|
uxCriticalNesting = 0;
|
||||||
vPortEnableInterrupts();
|
vPortEnableInterrupts();
|
||||||
|
|
||||||
|
/* Set thread name */
|
||||||
|
prvPortSetCurrentThreadName(pcTaskGetName(xTaskGetCurrentTaskHandle()));
|
||||||
|
|
||||||
/* Call the task's entry point. */
|
/* Call the task's entry point. */
|
||||||
pxThread->pxCode( pxThread->pvParams );
|
pxThread->pxCode( pxThread->pvParams );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue