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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b7062ec13fd16a9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-04 07:20:04 PST Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!oleane.net!oleane!nnrp.oleane.net!not-for-mail From: Thierry Lelegard Newsgroups: comp.lang.ada Subject: Re: Abort of C-code in a asynchronous_select Date: Tue, 04 Dec 2001 16:17:05 +0100 Organization: CANAL+ Technologies Message-ID: <3C0CE8F1.31F74C6@canal-plus.fr> References: <3C0CD717.F720A1DB@meppen.sema.slb.com> NNTP-Posting-Host: host227.canal-plus.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: s1.read.news.oleane.net 1007479026 31229 194.2.208.227 (4 Dec 2001 15:17:06 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Tue, 4 Dec 2001 15:17:06 +0000 (UTC) X-Sender: "Thierry Lelegard" X-Mailer: Mozilla 4.75 [fr]C-CCK-MCD C+ (WinNT; U) X-Accept-Language: en,fr,zh-CN,zh-TW Xref: archiver1.google.com comp.lang.ada:17386 Date: 2001-12-04T16:17:05+01:00 List-Id: > 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 ____________________________________________________________________________