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,345c606ef362d7fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-20 05:47:57 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.240.42.8!luth.se!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!news!not-for-mail From: Nige Newsgroups: comp.lang.ada Subject: Re: multitasking: finishing execution Date: Thu, 20 Jun 2002 13:48:39 +0100 Organization: Thales Message-ID: <3D11CF27.90401@uk.thalesgroup.com> References: <1HhQ8.8744$ZP1.1591823@news11-gui.server.ntli.net> NNTP-Posting-Host: ntwc0032.int.rdel.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: rdel.co.uk 1024577275 1382 172.21.187.19 (20 Jun 2002 12:47:55 GMT) X-Complaints-To: postmaster@uk.thalesgroup.com NNTP-Posting-Date: 20 Jun 2002 12:47:55 GMT User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0rc3) Gecko/20020523 X-Accept-Language: en-us, en Xref: archiver1.google.com comp.lang.ada:26477 Date: 2002-06-20T12:47:55+00:00 List-Id: chris.danx wrote: > Hi, > > Is calling the entry finish sufficient to terminate the task? The code of > the entry isn't the concern, but the behaviour of entries. Consider the > following procedure > > procedure finish_tasks is > begin > some_task.finish; -- 1 > ada.text_io.put ("some_task should have terminated"); -- 2 > end finish_tasks; > > > -- sample task code > -- > loop > select > accept Finish; > exit; > else > -- do some processing (sample code) > -- > if x < integer'last then > x := x + 1; > end if; > end select; > end loop; > > > Can the call to some_task.finish time out? If it can there's no guarantee > that the task has finished executing before the call to ada.text_io.put is > executed and the program may fail to terminate because it has running tasks, > correct? > > As you can see I'm a little confused by the fact that an entry can time out. > Does it mean that the call can time out no matter what or that the task has > to contain the appropriate code for an entry call to time out (such as a > delay altenative)? i.e. will the procedure wait indefinitely for the task > to terminate or will it abandon the entry call after some time elapses? > > If the code doesn't work as intended, what solution would you recommend? Is > there a better way? select accept Finish; else -- do code .... end select; will only process the accept if there is an outstanding call to it. For a call to timeout, you need to use: select some_task.finish; or delay