mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 17:17:36 +08:00
Linux: run threads without SCHED_FIFO if not privileged
When running the process without sufficient privilege to use real time scheduling, warn the user and run with SCHED_OTHER. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -153,7 +153,12 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
|
||||
|
||||
rv = pthread_create (&task, &attr, (void *)&entry_adapter, (void *) taskdata);
|
||||
if (rv != 0) {
|
||||
printf("px4_task_spawn_cmd: failed to create thread\n");
|
||||
printf("px4_task_spawn_cmd: failed to create thread %d %d\n", rv, errno);
|
||||
|
||||
if (rv == EPERM) {
|
||||
printf("WARNING: INSUFFICIENT PRIVILEGE TO RUN REALTIME THREADS\n");
|
||||
rv = pthread_create (&task, NULL, (void *)&entry_adapter, (void *) taskdata);
|
||||
}
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user