From b7355dc62b77b16bf63f56b9054ff249b4c14880 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Wed, 18 Mar 2015 18:00:24 -0300 Subject: [PATCH] AP_HAL_Linux: set thread name for ease debug Use pthread_setname_np() to set thread name so it's easier to debug what't going on with each of them. This is the example output of the relevant par of "ps -Leo class,rtprio,wchan,comm": FF 12 futex_ ArduCopter.elf FF 15 usleep sched-timer FF 14 hrtime sched-uart FF 13 poll_s sched-rcin FF 11 hrtime sched-tonealarm FF 10 hrtime sched-io --- libraries/AP_HAL_Linux/Scheduler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_HAL_Linux/Scheduler.cpp b/libraries/AP_HAL_Linux/Scheduler.cpp index 493c00d55d..6f85e8349c 100644 --- a/libraries/AP_HAL_Linux/Scheduler.cpp +++ b/libraries/AP_HAL_Linux/Scheduler.cpp @@ -49,6 +49,10 @@ void LinuxScheduler::_create_realtime_thread(pthread_t *ctx, int rtprio, panic(PSTR("Failed to create thread")); } pthread_attr_destroy(&attr); + + if (name) { + pthread_setname_np(*ctx, name); + } } void LinuxScheduler::init(void* machtnichts)