libs/libc/wqueue/work_usrthread.c: Eliminate a race condition noted by Xiang Xiao.
This commit is contained in:
parent
3a65d39eb8
commit
49e725625a
1 changed files with 9 additions and 1 deletions
|
@ -255,6 +255,14 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
|
|||
}
|
||||
}
|
||||
|
||||
/* Unlock the work queue before waiting. In order to assure that these
|
||||
* operations are atomic with respect to other user tasks, we disable
|
||||
* pre-emption here. Pre-emption will be re-enabled while we sleep.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
work_unlock();
|
||||
|
||||
if (next == WORK_DELAY_MAX)
|
||||
{
|
||||
sigset_t set;
|
||||
|
@ -276,7 +284,7 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
|
|||
usleep(next * USEC_PER_TICK);
|
||||
}
|
||||
|
||||
work_unlock();
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in a new issue