LP Work Queue: Fix test to find and idle worker thread.

This commit is contained in:
linfei_chen 2016-03-22 08:15:49 -06:00 committed by Gregory Nutt
parent bc325bd597
commit 4b18b8d1e3
2 changed files with 10 additions and 4 deletions

View File

@ -11577,4 +11577,6 @@
* net/tcp/tcp_timer.c: Fix some logic when there are multiple network
interfaces. In this case, TCP timeout events can really only being
processed when the poll from the correct device is received (2016-03-20).
* sched/wqueue/kwork_signal.c: Fix logic to find an IDLE worker thread;
the test for busy was backward. From Linfei Chen (2016-03-22).

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/wqueue/work_signal.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -92,15 +92,19 @@ int work_signal(int qid)
for (wndx = 0, i = 0; i < CONFIG_SCHED_LPNTHREADS; i++)
{
if (g_lpwork.worker[i].busy)
/* Is this worker thread busy? */
if (!g_lpwork.worker[i].busy)
{
/* No.. select this thread */
wndx = i;
break;
}
}
/* Use the process ID of the IDLE thread (or thread 0 is the are all
* busy)
/* Use the process ID of the IDLE worker thread (or the ID of worker
* thread 0 if all of the worker threads are busy).
*/
pid = g_lpwork.worker[wndx].pid;