mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-05 13:48:53 +08:00
hrt_work_queue posix: only send a wake-up signal if not called from own thread
The simulated timer interrupt always adds a new scheduled work task, which is called from the work queue thread. Sending the signal creates measurable overhead (~5% of the px4 CPU runtime) and is unnecessary, since the thread is not sleeping anyway.
This commit is contained in:
@@ -121,11 +121,15 @@ int hrt_work_queue(struct work_s *work, worker_t worker, void *arg, uint32_t del
|
||||
//PX4_INFO("hrt work_queue adding work delay=%u time=%lu", delay, work->qtime);
|
||||
|
||||
dq_addlast((dq_entry_t *)work, &wqueue->q);
|
||||
|
||||
if (px4_getpid() != wqueue->pid) { /* only need to wake up if called from a different thread */
|
||||
#ifdef __PX4_QURT
|
||||
px4_task_kill(wqueue->pid, SIGALRM); /* Wake up the worker thread */
|
||||
px4_task_kill(wqueue->pid, SIGALRM); /* Wake up the worker thread */
|
||||
#else
|
||||
px4_task_kill(wqueue->pid, SIGCONT); /* Wake up the worker thread */
|
||||
//wqueue->pid == own task? -> don't signal
|
||||
px4_task_kill(wqueue->pid, SIGCONT); /* Wake up the worker thread */
|
||||
#endif
|
||||
}
|
||||
|
||||
hrt_work_unlock();
|
||||
return PX4_OK;
|
||||
|
||||
Reference in New Issue
Block a user