Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sched/wqueue: fix issue about worker can't wake up thread before work_thread running #9007

Merged
merged 1 commit into from Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions sched/wqueue/kwork_thread.c
Expand Up @@ -139,13 +139,6 @@ static int work_thread(int argc, FAR char *argv[])

for (; ; )
{
/* Then process queued work. work_process will not return until: (1)
* there is no further work in the work queue, and (2) semaphore is
* posted.
*/

nxsem_wait_uninterruptible(&wqueue->sem);

/* And check each entry in the work queue. Since we have disabled
* interrupts we know: (1) we will not be suspended unless we do
* so ourselves, and (2) there will be no changes to the work queue
Expand Down Expand Up @@ -182,6 +175,13 @@ static int work_thread(int argc, FAR char *argv[])
CALL_WORKER(worker, arg);
flags = enter_critical_section();
}

/* Then process queued work. work_process will not return until: (1)
* there is no further work in the work queue, and (2) semaphore is
* posted.
*/

nxsem_wait_uninterruptible(&wqueue->sem);
}

leave_critical_section(flags);
Expand Down