|
51 | 51 | *----------------------------------------------------------*/
|
52 | 52 | #include "portmacro.h"
|
53 | 53 |
|
| 54 | +#ifdef __linux__ |
| 55 | + #define __USE_GNU |
| 56 | +#endif |
| 57 | + |
54 | 58 | #include <errno.h>
|
55 | 59 | #include <pthread.h>
|
56 | 60 | #include <signal.h>
|
@@ -134,6 +138,16 @@ void prvFatalError( const char * pcCall,
|
134 | 138 | }
|
135 | 139 | /*-----------------------------------------------------------*/
|
136 | 140 |
|
| 141 | +static void prvPortSetCurrentThreadName(char * pxThreadName) |
| 142 | +{ |
| 143 | +#ifdef __APPLE__ |
| 144 | + pthread_setname_np(pxThreadName); |
| 145 | +#else |
| 146 | + pthread_setname_np(pthread_self(), pxThreadName); |
| 147 | +#endif |
| 148 | +} |
| 149 | +/*-----------------------------------------------------------*/ |
| 150 | + |
137 | 151 | /*
|
138 | 152 | * See header file for description.
|
139 | 153 | */
|
@@ -224,6 +238,7 @@ BaseType_t xPortStartScheduler( void )
|
224 | 238 | const ListItem_t * pxEndMarker;
|
225 | 239 |
|
226 | 240 | hMainThread = pthread_self();
|
| 241 | + prvPortSetCurrentThreadName("Scheduler"); |
227 | 242 |
|
228 | 243 | /* Start the timer that generates the tick ISR(SIGALRM).
|
229 | 244 | * Interrupts are disabled here already. */
|
@@ -383,6 +398,8 @@ static void * prvTimerTickHandler( void * arg )
|
383 | 398 | {
|
384 | 399 | ( void ) arg;
|
385 | 400 |
|
| 401 | + prvPortSetCurrentThreadName("Scheduler timer"); |
| 402 | + |
386 | 403 | while( xTimerTickThreadShouldRun )
|
387 | 404 | {
|
388 | 405 | /*
|
@@ -493,6 +510,9 @@ static void * prvWaitForStart( void * pvParams )
|
493 | 510 | uxCriticalNesting = 0;
|
494 | 511 | vPortEnableInterrupts();
|
495 | 512 |
|
| 513 | + /* Set thread name */ |
| 514 | + prvPortSetCurrentThreadName(pcTaskGetName(xTaskGetCurrentTaskHandle())); |
| 515 | + |
496 | 516 | /* Call the task's entry point. */
|
497 | 517 | pxThread->pxCode( pxThread->pvParams );
|
498 | 518 |
|
|
0 commit comments