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:
Heesub Shin
2016-11-06 07:56:38 -06:00
committed by Gregory Nutt
parent 796969f6b6
commit 8e94d8e7cc
2 changed files with 12 additions and 9 deletions
+2 -2
View File
@@ -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);