From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 21 11:03:25 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC263EE6 for ; Tue, 21 Apr 2015 11:03:25 +0000 (UTC) Received: from mail-oi0-x22a.google.com (mail-oi0-x22a.google.com [IPv6:2607:f8b0:4003:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A40451701 for ; Tue, 21 Apr 2015 11:03:25 +0000 (UTC) Received: by oign205 with SMTP id n205so149634859oig.2 for ; Tue, 21 Apr 2015 04:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=EjHZb7Cru1PwbtLKoEtB7g2h9VXd1HVq3c44gdblY60=; b=QgEl9zVzZBpH+TVHZvuiiXFFebkYgXJbHwWkBs3ZMxbKk4WFc43pyFIQN8rfStdmL/ /GazFJPJLbawmCLEmRx94LQ19WZ1Be0QW1HE6gEAbhgGtg8UVtYIgHKlp6ipuWKKZvRr 3F3Z0ESJiG6OcNKvQRioRD9Fr0/oS0jF5O1P+dOaRmzzT0HuKow5MxDN4YZuasT1qfxp dTzHR3aHNRNZlsen10UuZlMkKdCxD9s2O8LRu1gJiTWpk1zUd1rwfIlGDspXz00Om9rJ cYg1Nnff2A5hSA0sRo54oGKleGxhQ35deI4nDVeIYJ8ghK3QGfsiqVKQ38a/EQhODWoP mTmg== MIME-Version: 1.0 X-Received: by 10.182.241.197 with SMTP id wk5mr18686429obc.0.1429614204997; Tue, 21 Apr 2015 04:03:24 -0700 (PDT) Received: by 10.60.24.10 with HTTP; Tue, 21 Apr 2015 04:03:24 -0700 (PDT) Date: Tue, 21 Apr 2015 16:33:24 +0530 Message-ID: Subject: Clarification: Acquiring a mutex when a read/write lock is held From: Dheeraj Kandula To: freebsd-hackers@freebsd.org X-Mailman-Approved-At: Tue, 21 Apr 2015 11:33:55 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2015 11:03:25 -0000 Hey All, Can you clarify the following I have a read write lock locked. Next I want to acquire a mutex when the read write lock is held. Is this allowed or not. As far as I can understand from the "FreeBSD Kernel Developers Handbook" this operation is allowed in FreeBSD9.0, 10.0 and further. But the read write lock cannot be held while sleeping. Doesn't this contradict the above statement, as a thread will go to sleep if can't acquire the mutex when another thread holds the mutex. Hence what sleep are we referring here. Is this sleep(unbounded sleep) or the bounded sleep. Dheeraj