Ensure that the semaphore value is re-checked after sem_lock

is re-acquired, after the condition variable is signalled.

PR:             http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
MFC after:      5 days
Reviewed by:    attilio
This commit is contained in:
Bruce M Simpson 2009-03-12 10:36:39 +00:00
parent b2966a5a2f
commit 77d8bf9cc7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189736

View File

@ -727,7 +727,7 @@ kern_sem_wait(struct thread *td, semid_t id, int tryflag,
#endif
DP(("kern_sem_wait value = %d, tryflag %d\n", ks->ks_value, tryflag));
vfs_timestamp(&ks->ks_atime);
if (ks->ks_value == 0) {
while (ks->ks_value == 0) {
ks->ks_waiters++;
if (tryflag != 0)
error = EAGAIN;