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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e44790cdcea9da82 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Problem with -gnatt References: <41651D37.4030805@mailinator.com> <2skt9qF1ljjdtU1@uni-berlin.de> <4165472D.2030704@mailinator.com> <416573FA.4010003@mailinator.com> <87k6u2mj08.fsf@insalien.org> <4166538E.6090907@mailinator.com> <41702af7$0$91003$39cecf19@news.twtelecom.net> <417377F7.7050506@mailinator.com> <4173f0ed$0$91003$39cecf19@news.twtelecom.net> <417409AB.8040702@mailinator.com> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 19 Oct 2004 00:20:50 GMT NNTP-Posting-Host: 64.185.133.124 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1098145250 64.185.133.124 (Mon, 18 Oct 2004 17:20:50 PDT) NNTP-Posting-Date: Mon, 18 Oct 2004 17:20:50 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:5421 Date: 2004-10-19T00:20:50+00:00 List-Id: "Alex R. Mosteo" writes: > I know the RM advice but, is there any special reason why it's better > to wait for a semaphore instead of a protected object? I don't need > timeouts nor abort semantics, I'll just wait what it is needed. I think it has something to do with the overhead of acquiring the lock, either by boosting the priority of the task executing the protected action, or because spinlocks are uesd, etc. You also have to make sure that you don't make any "potentially blocking" calls during execution of the protected action. (I don't think you do in your example, but I didn't study it enough to be sure.) > I already have a class like this, but I simply don't like manually > putting semaphores around except for a good reason. Please enlighten > me :) What do you have against semaphores? As long as you arrange for the semaphore to get released (which you can do using a controlled helper type, as in my example), then there's no reason not to use a semaphore. My advice is to follow the RM's advice...