mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 04:51:35 +08:00
Work threads: Ensure they have proper names
This commit is contained in:
@@ -195,7 +195,7 @@ void work_queues_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create high priority worker thread
|
// 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_DEFAULT,
|
||||||
SCHED_PRIORITY_MAX - 1,
|
SCHED_PRIORITY_MAX - 1,
|
||||||
2000,
|
2000,
|
||||||
@@ -203,7 +203,7 @@ void work_queues_init(void)
|
|||||||
(char *const *)NULL);
|
(char *const *)NULL);
|
||||||
|
|
||||||
// Create low priority worker thread
|
// 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_DEFAULT,
|
||||||
SCHED_PRIORITY_MIN,
|
SCHED_PRIORITY_MIN,
|
||||||
2000,
|
2000,
|
||||||
@@ -306,6 +306,14 @@ int work_usrthread(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Loop forever */
|
/* 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 (;;) {
|
for (;;) {
|
||||||
/* Then process queued work. We need to keep interrupts disabled while
|
/* Then process queued work. We need to keep interrupts disabled while
|
||||||
* we process items in the work list.
|
* we process items in the work list.
|
||||||
|
|||||||
Reference in New Issue
Block a user