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 2002:a24:a383:: with SMTP id p125-v6mr7705883ite.32.1524493231950; Mon, 23 Apr 2018 07:20:31 -0700 (PDT) X-Received: by 2002:a9d:620d:: with SMTP id g13-v6mr349255otj.3.1524493231802; Mon, 23 Apr 2018 07:20:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!81.171.65.13.MISMATCH!peer01.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!k65-v6no3080388ita.0!news-out.google.com!15-v6ni3833itg.0!nntp.google.com!k65-v6no3080386ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 23 Apr 2018 07:20:31 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=73.205.150.94; posting-account=Ru7E4QoAAAC_HiQ2D8LjZ7rh1mbTNcVn NNTP-Posting-Host: 73.205.150.94 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Using the "Terminated" aspect for a task passed to a generic From: NiGHTS Injection-Date: Mon, 23 Apr 2018 14:20:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2951 X-Received-Body-CRC: 597096227 Xref: reader02.eternal-september.org comp.lang.ada:51676 Date: 2018-04-23T07:20:31-07:00 List-Id: Having looked carefully through 2 Ada reference books, one dedicated to tas= king, and using Google to no end, I am stumped on the following Ada dilemma= .=20 generic type Managed_Task_Type is limited private; package WD is task WD_Thread; end WD; package body WD is task body WD_Thread is =20 M : Managed_Task_Type; begin =20 loop if M'Terminated then =20 exit; end if; =20 end loop; =20 end WD_Thread; =20 end WD;=20 The above is an overly simplified case study of the problem I am having. Do= n't mind the busy wait loop as it would not be used in practice. Basically I am passing a Task of an unknown structure to a generic package = that itself runs a task whose sole job is to monitor the provided task. App= arently since the Generic doesn't know that this is a task, the compiler wi= ll not allow me to use the Terminated aspect to learn when it has completed= . Is there a way to hint to the compiler that this is indeed a task object? O= r is there an alternative method to determine if the task has terminated? I suppose the worst case scenario is to pass a protected boolean to the M t= hread that will set the flag upon any sort of termination. Problem with tha= t strategy is that I don't trust the programmer of the task to do this cons= istently. So then i'd have to write a task interface, elaborate each of my = task types, and pass that to the generic... all because my terminated aspec= t doesn't work in this context. Any help is appreciated, thanks!