comp.lang.ada
 help / color / mirror / Atom feed
From: Brian May <bam@snoopy.apana.org.au>
Subject: Re: Advantages
Date: Fri, 02 Jul 2004 10:49:52 +1000
Date: 2004-07-02T10:49:52+10:00	[thread overview]
Message-ID: <sa4k6xnutan.fsf@snoopy.apana.org.au> (raw)
In-Reply-To: OvqdnfpKdd5NKnzdRVn-hw@megapath.net

>>>>> "Randy" == Randy Brukardt <randy@rrsoftware.com> 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

<hat mode="devils advocate">

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>
-- 
Brian May <bam@snoopy.apana.org.au>



  reply	other threads:[~2004-07-02  0:49 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             ` Brian May [this message]
2004-07-02  1:31               ` Advantages Jeffrey Carter
2004-07-02  9:13               ` Advantages Dmitry A. Kazakov
2004-07-02 12:27               ` Advantages Marin David Condic
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