Work queues: Logic that sets the queued indication and the logic that does the actual queuing must be atomic

This commit is contained in:
Gregory Nutt
2015-09-30 11:04:29 -06:00
parent e35737ca88
commit 4cd57e1e4e
6 changed files with 26 additions and 21 deletions
+6 -6
View File
@@ -107,16 +107,16 @@ static int work_qqueue(FAR struct usr_wqueue_s *wqueue,
{
DEBUGASSERT(work != NULL);
/* First, initialize the work structure */
work->worker = worker; /* Work callback */
work->arg = arg; /* Callback argument */
work->delay = delay; /* Delay until work performed */
/* Get exclusive access to the work queue */
while (work_lock() < 0);
/* Initialize the work structure */
work->worker = worker; /* Work callback. non-NULL means queued */
work->arg = arg; /* Callback argument */
work->delay = delay; /* Delay until work performed */
/* Now, time-tag that entry and put it in the work queue. */
work->qtime = clock_systimer(); /* Time work queued */