Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Mar 2009 01:12:35 +0000 (UTC)
From:      Bruce M Simpson <bms@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r189781 - stable/7/sys/kern
Message-ID:  <200903140112.n2E1CZmM077949@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903140112.n2E1CZmM077949>