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=0.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7897733b1978b6a4,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.42.163.65 with SMTP id b1mr13685501icy.2.1321544020576; Thu, 17 Nov 2011 07:33:40 -0800 (PST) Path: h5ni1808pba.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Rego, P." Newsgroups: comp.lang.ada Subject: Freezing a task Date: Thu, 17 Nov 2011 07:33:24 -0800 (PST) Organization: http://groups.google.com Message-ID: <32992849.648.1321544004241.JavaMail.geo-discussion-forums@vbmh5> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 201.7.145.1 Mime-Version: 1.0 X-Trace: posting.google.com 1321544014 443 127.0.0.1 (17 Nov 2011 15:33:34 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Nov 2011 15:33:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=201.7.145.1; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu User-Agent: G2/1.0 X-Google-Web-Client: true Xref: news2.google.com comp.lang.ada:14433 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-17T07:33:24-08:00 List-Id: Is is possible to freeze a task? I mean, if I have a task task body My_Task is begin=20 accept Start; loop Put ("1"); Put ("2"); Put ("3"); ... Put ("n"); end loop; end My_Task; is there a way that I can "freeze" the task in its current state? If, for i= nstance, the execution finished executing Put ("2");, how can I freeze it a= nd later I can turn it to continue? I want to provoque a freeze from outsid= e the task, and also from outside, order it to continue. I could sure implement, if I had the spec like type State_Type is (RUN, FROZEN); task type My_Task (State : State_Type) is entry Start; end My_Task; -- the body: task body My_Task is begin=20 accept Start; loop Put ("1"); Put ("2"); Put ("3"); ... Put ("n"); loop=20 if State =3D RUN then exit; end if; end loop; end loop; end My_Task; but it would not be the case because I had to wait for the nth Put instruct= ion line (i.e., the task would not be actually frozen, because the inside l= oop would be running). And T.E.D. from stackoverflow suggested me something that I could infer as task type My_Task (Start : Start_Type) is=20 entry Start; entry Run; end My_Task -- task body My_Task is begin=20 accept Start; loop Put ("1"); Put ("2"); Put ("3"); ... Put ("n"); if State =3D FROZEN then=20 accept Run; State :=3D RUN; end if; end loop; end My_Task; Is there a more elegant way to do this? Maybe some procedure My_Task.Freeze= Now in a unknown (by me) package? Thanks