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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.13.223.84 with SMTP id i81mr13326725ywe.9.1472744630610; Thu, 01 Sep 2016 08:43:50 -0700 (PDT) X-Received: by 10.157.51.45 with SMTP id f42mr1621838otc.12.1472744630563; Thu, 01 Sep 2016 08:43:50 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!j37no12185399qta.0!news-out.google.com!w143ni787itb.0!nntp.google.com!i184no358813itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 1 Sep 2016 08:43:50 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:8a0:6a4f:fe01:bc32:3b9e:20d2:48bc; posting-account=nd46uAkAAAB2IU3eJoKQE6q_ACEyvPP_ NNTP-Posting-Host: 2001:8a0:6a4f:fe01:bc32:3b9e:20d2:48bc User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6e4d6fc1-dcb9-454a-8c1e-df090224438e@googlegroups.com> Subject: Rendezvous with select ... else and "or terminate" not possible - but how do I quit this task? From: Some Dude Injection-Date: Thu, 01 Sep 2016 15:43:50 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:31676 Date: 2016-09-01T08:43:50-07:00 List-Id: I have a task with entries Start, Stop, Send, Close and an else clause that does some main processing when none of the entries are processed. So the structure is (very simplified): task body Connection_Handler is Done : Boolean := False; begin accept Start (Socket : Socket_Type) do -- do this first end Start; loop select when not Done => accept Stop do Done := True; end Stop; or when not Done => accept Send (Socket : Socket_Type; Command : Command_Type) do -- do something end Send; or when not Done => accept Close (Socket : Socket_Type) do -- do something end Close; else if not Done then -- receive data if necessary using GNAT.sockets.Check_Selector -- while no data is sent end if; end select; exit when Done; end loop; end Connection_Handler; However, when Stop is called and Done set to True, I get raised TASKING_ERROR : s-tasren.adb:445 as an exception in my AUnit test harness and the test ends prematurely with an error code. This occurs in the main program task, or at least if I add a catch-all exception handler in the above task body, it is *not* triggered there. I thought this occurs perhaps because there is no terminate alternative, but if I add: or terminate; before the else part, I get the error message "else part not allowed with other alternatives". So this is not possible. Is there a way to stop the task gracefully (without abort) but also do some continuous processing like in the else part? Does anybody have an idea what might cause this error?