Browse Source

Work threads: Ensure they have proper names

sbg
Lorenz Meier 9 years ago
parent
commit
79a030ec50
  1. 12
      src/platforms/posix/work_queue/work_thread.c

12
src/platforms/posix/work_queue/work_thread.c

@ -195,7 +195,7 @@ void work_queues_init(void) @@ -195,7 +195,7 @@ void work_queues_init(void)
#endif
// Create high priority worker thread
g_work[HPWORK].pid = px4_task_spawn_cmd("wkr_high",
g_work[HPWORK].pid = px4_task_spawn_cmd("hpwork",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 1,
2000,
@ -203,7 +203,7 @@ void work_queues_init(void) @@ -203,7 +203,7 @@ void work_queues_init(void)
(char *const *)NULL);
// Create low priority worker thread
g_work[LPWORK].pid = px4_task_spawn_cmd("wkr_low",
g_work[LPWORK].pid = px4_task_spawn_cmd("lpwork",
SCHED_DEFAULT,
SCHED_PRIORITY_MIN,
2000,
@ -306,6 +306,14 @@ int work_usrthread(int argc, char *argv[]) @@ -306,6 +306,14 @@ int work_usrthread(int argc, char *argv[])
{
/* Loop forever */
int rv;
// set the threads name
#ifdef __PX4_DARWIN
rv = pthread_setname_np("USR");
#else
rv = pthread_setname_np(pthread_self(), "USR");
#endif
for (;;) {
/* Then process queued work. We need to keep interrupts disabled while
* we process items in the work list.

Loading…
Cancel
Save