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 Path: g2news1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread3.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <40E55491.20907@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Advantages References: <2k86nbF18idtrU1@uni-berlin.de> <3p5Ec.13759$Av3.4246@nwrdny01.gnilink.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 02 Jul 2004 12:27:47 GMT NNTP-Posting-Host: 209.165.3.224 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.atl.earthlink.net 1088771267 209.165.3.224 (Fri, 02 Jul 2004 05:27:47 PDT) NNTP-Posting-Date: Fri, 02 Jul 2004 05:27:47 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:2047 Date: 2004-07-02T12:27:47+00:00 List-Id: A complicated situation like this would seem to want some sort of lower-level task acting as the manager of the device. It would need to be providing a lot more logic than you get inherently from a protected type. The protected type is designed just to get exclusive write access to some collection of data - not really manage lots of logic about ordering the accesses to the data. I've seen this kind of need before - commonly if you're handling a slow A/D converter where you need to point a mux, wait for it to settle, start a conversion wait for it to convert and then collect the sample. Usually with that kind of situation, its done with only one thread controlling the device and deciding how best to manage it - not with a protected type. MDC Brian May wrote: > > 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... > > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Face it ladies, its not the dress that makes you look fat. Its the FAT that makes you look fat." -- Al Bundy ======================================================================