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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c1eb2426ab1cc481 X-Google-Attributes: gid103376,public From: m193884@csehp1.mdc.com (James A. Squire) Subject: Re: Tasking In Ada 83 "Question" Date: 1997/03/18 Message-ID: <5gngor$24j@csehp1.mdc.com>#1/1 X-Deja-AN: 226603654 References: <332F3050.74B8@mccabe.com> Organization: McDonnell Douglas Aerospace Newsgroups: comp.lang.ada Date: 1997-03-18T00:00:00+00:00 List-Id: In article <332F3050.74B8@mccabe.com>, Michael Ibarra wrote: >I have a task, and I want to perform some action when I know that my >task has terminated. I can't tell when it has terminated. My task >looks something like: > >Task Body timer is >begin >loop > select > accept receive_call do > null; > end receive_call; > or > terminate; > end select; >end loop; >end timer; > >My problem is that in order to check the terminated attribute of the >task, I need to with the package that is parent/master to the task, >therefore preventing it from becoming terminated. I don't quite understand this statement. If the task is pretty much like you have it there, withing it's parent seems to have absolutely nothing to do with preventing it from becoming terminated. Or else I don't have enough information here. It seems to me that what prevents this task from terminating is the mere fact that the program is still running, since the only way it terminates (apart from some other task aborting it or an exception being raised from within) is when all other tasks including the main task are finished - hence when the program is finished. There is no stop entry, and the loop is endless. The terminate statement only ensures that the program won't be left hanging if every other task is finished. >This is NEVER true. Is there any way that I can konw when this task >has terminated. I wanted to perform some jobs ONLY after this task >is terminated. If you want to do anything after such a task terminates, then you'll have to pick some other way for the task to terminate, it seems to me. The options I'm aware of are: (1) adding a Stop entry, (2) adding some condition that exits the loop, (3) abort the task. It looks like (2) is closest to what you are looking for since you are treating termination of this task as if it is non-deterministic to the other tasks in your program. Either that or you need to give us more info. -- James Squire mailto:m193884 no junk mail allowed@csehp1.mdc.com MDA Avionics Tools & Processes McDonnell Douglas Aerospace http://www.mdc.com/ Opinions expressed here are my own and NOT my company's