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,3a3dffa82925efee X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: Advantages References: <2k86nbF18idtrU1@uni-berlin.de> <3p5Ec.13759$Av3.4246@nwrdny01.gnilink.net> From: Brian May X-Home-Page: http://snoopy.apana.org.au/~bam/ Date: Fri, 02 Jul 2004 10:49:52 +1000 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:h2q2SYLdAIGMl/eYXuaAgS9qqvo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: dsl-202-173-153-89.vic.westnet.com.au X-Trace: news.melbourne.pipenetworks.com 1088729393 202.173.153.89 (2 Jul 2004 10:49:53 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!priapus.visi.com!orange.octanews.net!news-out.visi.com!petbe.visi.com!news.octanews.net!news1.optus.net.au!optus!news.mel.connect.com.au!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:2037 Date: 2004-07-02T10:49:52+10:00 List-Id: >>>>> "Randy" == Randy Brukardt writes: Randy> That's correct. And it makes sense to allow I/O, as many Randy> implementation don't in fact do anything blocking. But I Randy> would expect that the implementation would treat things Randy> that are *known* to be blocking (like a delay statement) Randy> differently - there can be no legitimate reason for doing Randy> that. In a ceiling locking implementation, blocking would You want to send a message to a hardware device. The requirements specify that one message should be sent to the device, followed by a fixed delay, then another message. During this entire period of time, exclusive access is required to the device, because other threads could otherwise interfere. Lets also assume that sending the message is a blocking function that will block until either an acknowledgement or error is returned by the device. What is the safest way of implementing this under Ada? Three blocking statements, that require exclusive access to a resource. You could have a protected type emulate a semaphore, but then we are back to using primitive operations (and related mistakes) that Ada was meant to avoid. You could have these 3 statements run from a procedure within a protected type (along with procedures to do other things), but you not suppose to make calls that potentially block from a protected type. Just curious as to the recommended way of dealing with this situation... -- Brian May