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 09:19:59 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!demon!shale.ftech.net!news.ftech.net!peernews.cix.co.uk!newspeer1-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <1HhQ8.8744$ZP1.1591823@news11-gui.server.ntli.net> <3D11CF27.90401@uk.thalesgroup.com> Subject: Re: multitasking: finishing execution X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Thu, 20 Jun 2002 17:19:31 +0100 NNTP-Posting-Host: 80.5.140.234 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1024589999 80.5.140.234 (Thu, 20 Jun 2002 17:19:59 BST) NNTP-Posting-Date: Thu, 20 Jun 2002 17:19:59 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:26498 Date: 2002-06-20T17:19:31+01:00 List-Id: "Nige" wrote in message news:3D11CF27.90401@uk.thalesgroup.com... > select > accept Finish; > else > -- do code > .... > end select; > > will only process the accept if there is an outstanding call to it. If a handler calls Finish will it wait indefinitely for the task to accept it? That was the original question, although in retrospect the first post was just confusing. The problem involves a window and two tasks, a watcher and a builder. A watcher scans the keyboard, placing any keypresses corresponding to commands into a protected object, unless Finish is called at which point the watcher terminates. The builder retrieves a keypress from the protected object and does some processing with it until it recieves a call to Finish, when it terminates. Upon creation of the window, a handler 'on_create' starts both tasks. When the user quits the application (more precisely closes a window, which in this case happens to be the main window) the on_destroy handler terminates the task. My concern is what would happen if the call to the Finish was not accepted before any time limit expired. Cohen states that a task must finish execution before a program can terminate (which makes sense), if the call wasn't accepted and subsequenctly abandoned the program would fail to terminate. If the builder processes information too quickly, any animation will be done and over with before the user realises it (also if the redraw method is called continuously it will crash the system, which happened when I forgot to clear the flag which records if a keypress is available). To alleviate this problem a delay alternative has been added to the code, which waits around 20ms before doing any processing. (A better solution might be to use a protected object describing the state and another task which translates this and draws it to the screen, but this is just practise with tasks and gwindows before the main project). If a call to an entry is placed after the delay alternative expires will the entry succeed (be accepted by the task) in the next iteration (assuming the next iteration is free to proceed)? I think it will since entries queue, but just want to make sure. Thanks, Chris