LP worker: When queuing new work, don't signal any threads if they are all busy
This commit is contained in:
parent
796969f6b6
commit
3c2a00bc4b
@ -152,7 +152,7 @@ int work_queue(int qid, FAR struct work_s *work, worker_t worker,
|
|||||||
#ifdef CONFIG_SCHED_HPWORK
|
#ifdef CONFIG_SCHED_HPWORK
|
||||||
if (qid == 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);
|
work_qqueue((FAR struct kwork_wqueue_s *)&g_hpwork, work, worker, arg, delay);
|
||||||
return work_signal(HPWORK);
|
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
|
#ifdef CONFIG_SCHED_LPWORK
|
||||||
if (qid == 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);
|
work_qqueue((FAR struct kwork_wqueue_s *)&g_lpwork, work, worker, arg, delay);
|
||||||
return work_signal(LPWORK);
|
return work_signal(LPWORK);
|
||||||
|
@ -85,12 +85,11 @@ int work_signal(int qid)
|
|||||||
#ifdef CONFIG_SCHED_LPWORK
|
#ifdef CONFIG_SCHED_LPWORK
|
||||||
if (qid == LPWORK)
|
if (qid == LPWORK)
|
||||||
{
|
{
|
||||||
int wndx;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Find an IDLE worker thread */
|
/* Find an IDLE worker thread */
|
||||||
|
|
||||||
for (wndx = 0, i = 0; i < CONFIG_SCHED_LPNTHREADS; i++)
|
for (i = 0; i < CONFIG_SCHED_LPNTHREADS; i++)
|
||||||
{
|
{
|
||||||
/* Is this worker thread busy? */
|
/* Is this worker thread busy? */
|
||||||
|
|
||||||
@ -98,16 +97,20 @@ int work_signal(int qid)
|
|||||||
{
|
{
|
||||||
/* No.. select this thread */
|
/* No.. select this thread */
|
||||||
|
|
||||||
wndx = i;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the process ID of the IDLE worker thread (or the ID of worker
|
/* If all of the IDLE threads are busy, then just return successfully */
|
||||||
* thread 0 if all of the worker threads are busy).
|
|
||||||
*/
|
|
||||||
|
|
||||||
pid = g_lpwork.worker[wndx].pid;
|
if (i >= CONFIG_SCHED_LPNTHREADS)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, signal the first IDLE thread found */
|
||||||
|
|
||||||
|
pid = g_lpwork.worker[i].pid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user