mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-12 21:17:37 +08:00
px4_work_queue: revert inherited sched attr and run wq:manager and max priority
Setting PTHREAD_EXPLICIT_SCHED was necessary on linux to create WQ threads with priorities relative to max, but unfortunately we can't rely pthread_attr_setinheritsched as it's dependent on system ulimit configuration or running privileged. Instead we can create the wq:manager at the maximum desired priority and allow each WQ thread to have a relative priority.
This commit is contained in:
@@ -270,14 +270,6 @@ WorkQueueManagerRun(int, char **)
|
||||
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
int ret_setschedpolicy = pthread_attr_setschedpolicy(&attr, SCHED_RR);
|
||||
#else
|
||||
|
||||
// don't inherit attributes from parent thread
|
||||
int ret_setinheritsched = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
|
||||
if (ret_setinheritsched != 0) {
|
||||
PX4_ERR("failed to set inherit-scheduler attribute PTHREAD_EXPLICIT_SCHED (%i)", ret_setinheritsched);
|
||||
}
|
||||
|
||||
int ret_setschedpolicy = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
|
||||
#endif
|
||||
|
||||
@@ -327,7 +319,7 @@ WorkQueueManagerStart()
|
||||
|
||||
int task_id = px4_task_spawn_cmd("wq:manager",
|
||||
SCHED_DEFAULT,
|
||||
PX4_WQ_HP_BASE,
|
||||
SCHED_PRIORITY_MAX,
|
||||
1280,
|
||||
(px4_main_t)&WorkQueueManagerRun,
|
||||
nullptr);
|
||||
|
||||
Reference in New Issue
Block a user