Author: bms
Date: Sat Mar 14 01:12:35 2009
New Revision: 189781
URL: http://svn.freebsd.org/changeset/base/189781

Log:
  MFC rev: 189736
    Ensure that the semaphore value is re-checked after sem_lock
    is re-acquired, after the condition variable is signalled.
  
  Early MFC, as the test case in the PR is fairly complete and the
  submitter also re-ran test case on -STABLE. It also bites Python
  fairly hard, which will otherwise try to use POSIX sems for its
  internal thread synchronization; this needs more in-depth testing.
  
  PR:           http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
  Reviewed by:  attilio

Modified:
  stable/7/sys/kern/uipc_sem.c

Modified: stable/7/sys/kern/uipc_sem.c
==============================================================================
--- stable/7/sys/kern/uipc_sem.c        Sat Mar 14 00:33:08 2009        
(r189780)
+++ stable/7/sys/kern/uipc_sem.c        Sat Mar 14 01:12:35 2009        
(r189781)
@@ -722,7 +722,7 @@ kern_sem_wait(struct thread *td, semid_t
 #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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to