userspace/wqueue: move exclusive access lock to mqueue inside

Change-Id: I885d5641bc81fedf698c241d4719cb3561700f17
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2021-07-12 20:58:03 +08:00
committed by dongjiuzhu1
parent 09630961b3
commit eb6dd4fdc7
6 changed files with 12 additions and 173 deletions
+2 -2
View File
@@ -78,7 +78,7 @@ static int work_qqueue(FAR struct usr_wqueue_s *wqueue,
/* Get exclusive access to the work queue */
while (work_lock() < 0);
while (_SEM_WAIT(&wqueue->lock) < 0);
/* Is there already pending work? */
@@ -104,7 +104,7 @@ static int work_qqueue(FAR struct usr_wqueue_s *wqueue,
dq_addlast((FAR dq_entry_t *)work, &wqueue->q);
kill(wqueue->pid, SIGWORK); /* Wake up the worker thread */
work_unlock();
_SEM_POST(&wqueue->lock);
return OK;
}