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.
@@ -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;
