From owner-freebsd-threads@FreeBSD.ORG Tue Apr 21 10:30:22 2015 Return-Path: Delivered-To: freebsd-threads@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 079AB6CB for ; Tue, 21 Apr 2015 10:30:22 +0000 (UTC) Received: from mail-oi0-x232.google.com (mail-oi0-x232.google.com [IPv6:2607:f8b0:4003:c06::232]) (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 C392512D6 for ; Tue, 21 Apr 2015 10:30:21 +0000 (UTC) Received: by oift201 with SMTP id t201so150387558oif.3 for ; Tue, 21 Apr 2015 03:30:21 -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=mZ6lryBUnv+C/0lCcjSiU3CZaxihNH7VTejWeZHwxbY=; b=s/dbJzkuVL1DhLZ8SCWb/3QgOfPY9RnXkxMr/X1t3VwVmjIMlBSaExSYAEWxjdS537 jhsrMisSigWgGmAgBQkex7XQXEvu/miukaRhNhLbGH+vUylhPMg4qaCSgDjpJYuVUSor 1ndx3qydebVScAloL+lu+iDETygQX0VhsLIOm+0CDLBDYRCmiUetY62sllP9nu/u1KDI tBX62ZkekqwiQalyUAnceyWs29K9rVk0cm1kKFx2R4/r9A9ucALFFW8XgXMtILYHX5GG nuNocxFKOJvlJJu0WDP7THSxOilRXDhR48Y/jzZLp2wSRvqJfMKX+o5wl0m5TvkBGixO rFGQ== MIME-Version: 1.0 X-Received: by 10.182.250.134 with SMTP id zc6mr18584926obc.78.1429612221070; Tue, 21 Apr 2015 03:30:21 -0700 (PDT) Received: by 10.60.24.10 with HTTP; Tue, 21 Apr 2015 03:30:21 -0700 (PDT) Date: Tue, 21 Apr 2015 16:00:21 +0530 Message-ID: Subject: Clarification: Acquiring a mutex when a read write lock is held From: Dheeraj Kandula To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2015 10:30:22 -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 From owner-freebsd-threads@FreeBSD.ORG Wed Apr 22 15:05:28 2015 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D43EEC4 for ; Wed, 22 Apr 2015 15:05:28 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D45711CA4 for ; Wed, 22 Apr 2015 15:05:27 +0000 (UTC) Received: from Julian-MBP3.local (ppp121-45-229-105.lns20.per1.internode.on.net [121.45.229.105]) (authenticated bits=0) by vps1.elischer.org (8.14.9/8.14.9) with ESMTP id t3MF5Mxr016827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 22 Apr 2015 08:05:25 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <5537B8AD.5060009@freebsd.org> Date: Wed, 22 Apr 2015 23:05:17 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Dheeraj Kandula , freebsd-threads@freebsd.org Subject: Re: Clarification: Acquiring a mutex when a read write lock is held References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2015 15:05:28 -0000 On 4/21/15 6:30 PM, Dheeraj Kandula wrote: > 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 look at man 9 locking for an overview. > the bounded sleep. > > Dheeraj > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" > >