comp.lang.ada
 help / color / mirror / Atom feed
From: Thierry Lelegard <thierry.lelegard@canal-plus.fr>
Subject: Re: Abort of C-code in a asynchronous_select
Date: Tue, 04 Dec 2001 16:17:05 +0100
Date: 2001-12-04T16:17:05+01:00	[thread overview]
Message-ID: <3C0CE8F1.31F74C6@canal-plus.fr> (raw)
In-Reply-To: 3C0CD717.F720A1DB@meppen.sema.slb.com

> select
>    State.Not_Active;
> then abort
>    C_Driver.Read (Data, Data_Last);
> end select;
> 
> I am assuming that in case the Read-call is aborted, the semaphore in C
> isn't freed because C doesn't know anything about the Ada-abort. Am I
> correct and how can I do it better?

It entirely depends on the operating system and the implementation
of the Ada95 runtime. In your specific case, you can't even be sure
that the Read call is aborted. It may block until the read completes
(ie. the abort is ineffective).

ATC is extremely tricky. Generally speaking, it should be considered
safe only in specific cases such as compute-bound loops written in Ada.

When you try to abort non-Ada code (especially system services) using
ATC, you should check first with your Ada vendor in which cases this
will work.

Most Ada runtime libraries are implemented in user-mode on top of a
pthread (or pthread-like) system runtime. When a thread executes
inner-modes code (such as a device driver), there is simply no way
for a user-mode Ada runtime library to abort the call in a general
purpose manner.

As a programming rule, we have banned ATC in our developement teams. Full stop.
-Thierry
____________________________________________________________________________

Thierry Lelegard, "The Jazzing Troll", Email: thierry.lelegard@canal-plus.fr
CANAL+ Technologies, 34 place Raoul Dautry, 75906 Paris Cedex 15, France
Tel: +33 1 71 71 54 30   Fax: +33 1 71 71 52 08   Mobile: +33 6 03 00 65 75
____________________________________________________________________________



  reply	other threads:[~2001-12-04 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-04 14:00 Abort of C-code in a asynchronous_select Vincent Smeets
2001-12-04 15:17 ` Thierry Lelegard [this message]
2001-12-05  3:31   ` Robert Dewar
2001-12-05  6:15   ` Vincent Smeets
2001-12-05  8:59     ` Thierry Lelegard
replies disabled

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