From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,f59f5e1bef885a88 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.15.209 with SMTP id l17mr1051187bka.6.1345966596770; Sun, 26 Aug 2012 00:36:36 -0700 (PDT) Received: by 10.180.75.8 with SMTP id y8mr1124983wiv.4.1345966596330; Sun, 26 Aug 2012 00:36:36 -0700 (PDT) X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.116.97 Path: m12ni134824bkm.0!nntp.google.com!news1.google.com!yt1no49786270wib.1!news-out.google.com!q11ni321588179wiw.1!nntp.google.com!proxad.net!feeder1-2.proxad.net!nntpfeed.proxad.net!dedibox.gegeweb.org!gegeweb.eu!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Distributed Reader-Writer Mutex by Dmitry Vyukov Date: Sun, 26 Aug 2012 09:36:35 +0200 Organization: cbb software GmbH Message-ID: <2e1e5vd3umdz.17cznxo58oakq.dlg@40tude.net> References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 9A8bJrx4NhDLcSmbrb6AdA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-08-26T09:36:35+02:00 List-Id: On Sat, 25 Aug 2012 18:48:47 -0500, aminer wrote: > So i think you have to use a critical section around the for loop to be able > to lock all the rwlocks at the same time to avoid the deadlock problem.. Assuming that the critical section is system-wide, however that would not prevent deadlock because arrays of mutexes are naturally exposed to deadlocks. Considering the example you refer to, the array of mutexes does not deadlock (I am guessing), because all mutexes are taken and always in the same order. In any case, you should never do anything blocking within a critical section, and if you had system-wide critical sections available, you could implement system-wide mutex without resorting to individual mutexes. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de