mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Signal sent from work_signal() may interrupt the low priority worker thread that is already running. For example, the worker thread that is waiting for a semaphore could be woken up by the signal and break any synchronization assumption as a result. It also does not make any sense to send signal if it is already running and busy. This commit fixes it.
This commit is contained in:
committed by
Gregory Nutt
parent
796969f6b6
commit
8e94d8e7cc
@@ -152,7 +152,7 @@ int work_queue(int qid, FAR struct work_s *work, worker_t worker,
|
||||
#ifdef CONFIG_SCHED_HPWORK
|
||||
if (qid == HPWORK)
|
||||
{
|
||||
/* Cancel high priority work */
|
||||
/* Queue high priority work */
|
||||
|
||||
work_qqueue((FAR struct kwork_wqueue_s *)&g_hpwork, work, worker, arg, delay);
|
||||
return work_signal(HPWORK);
|
||||
@@ -162,7 +162,7 @@ int work_queue(int qid, FAR struct work_s *work, worker_t worker,
|
||||
#ifdef CONFIG_SCHED_LPWORK
|
||||
if (qid == LPWORK)
|
||||
{
|
||||
/* Cancel low priority work */
|
||||
/* Queue low priority work */
|
||||
|
||||
work_qqueue((FAR struct kwork_wqueue_s *)&g_lpwork, work, worker, arg, delay);
|
||||
return work_signal(LPWORK);
|
||||
|
||||
Reference in New Issue
Block a user