px4_work_queue: don't inherit pthread attributes from creating thread

- this is necessary on linux so that the WQ threads priorities are set relative to max, and not relative to the wq:manager thread
This commit is contained in:
Daniel Agar 2020-01-10 11:02:49 -05:00 committed by GitHub
parent 4d4481a384
commit a08b54b8e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -264,11 +264,20 @@ WorkQueueManagerRun(int, char **)
}
#ifndef __PX4_QURT
// schedule policy FIFO
#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