comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <nobody@noplace.com>
Subject: Re: Advantages
Date: Fri, 02 Jul 2004 12:27:47 GMT
Date: 2004-07-02T12:27:47+00:00	[thread overview]
Message-ID: <40E55491.20907@noplace.com> (raw)
In-Reply-To: sa4k6xnutan.fsf@snoopy.apana.org.au

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...
> 
> </hat>


-- 
======================================================================
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

======================================================================




  parent reply	other threads:[~2004-07-02 12:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  7:04 Advantages Andrew Carroll
2004-06-27 15:16 ` Advantages Nick Roberts
2004-06-27 21:22   ` Advantages Pascal Obry
2004-06-28  0:51   ` Advantages Robert I. Eachus
2004-06-28  1:59     ` Advantages Brian May
2004-06-29  0:24       ` Advantages Randy Brukardt
2004-06-29  3:32         ` Advantages Hyman Rosen
2004-06-29 18:41           ` Advantages Randy Brukardt
2004-07-02  0:49             ` Advantages Brian May
2004-07-02  1:31               ` Advantages Jeffrey Carter
2004-07-02  9:13               ` Advantages Dmitry A. Kazakov
2004-07-02 12:27               ` Marin David Condic [this message]
2004-07-04 17:42       ` Advantages Robert I. Eachus
2004-06-28 12:08   ` Advantages Marin David Condic
2004-06-27 18:32 ` Advantages Jim Rogers
  -- strict thread matches above, loose matches on Subject: below --
2004-06-28  9:52 Advantages Lionel.DRAGHI
     [not found] <20040628005515.0A1E74C4160@lovelace.ada-france.org>
2004-06-28  6:23 ` Advantages Andrew Carroll
2004-06-28 14:44   ` Advantages Jacob Sparre Andersen
2004-07-04 18:11   ` Advantages Robert I. Eachus
2004-06-26  6:28 Advantages Andrew Carroll
2004-06-25 19:41 Advantages Andrew Carroll
     [not found] <20040624170516.B4DFC4C4110@lovelace.ada-france.org>
2004-06-25 12:24 ` Advantages Andrew Carroll
2004-06-25 12:22   ` Advantages Peter Amey
2004-06-26 20:43   ` Advantages Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox