sched/wqueue: semaphore count should be consistent with the number of work entries.
The number of work entries will be inconsistent with semaphore count if the work is canceled, in extreme case, semaphore count will overflow and fallback to 0 the workqueue will stop scheduling the enqueue work. Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
8c52633bd0
commit
b9d70365a1
@ -88,6 +88,12 @@ static int work_qcancel(FAR struct kwork_wqueue_s *wqueue,
|
||||
else
|
||||
{
|
||||
dq_rem((FAR dq_entry_t *)work, &wqueue->q);
|
||||
|
||||
/* Semaphore count should be consistent with the number of
|
||||
* work entries.
|
||||
*/
|
||||
|
||||
wqueue->sem.semcount--;
|
||||
}
|
||||
|
||||
work->worker = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user