comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Lorenzen <mark.lorenzen@surfpost.dk>
Subject: Re: task time-out&abort
Date: 22 Jun 2005 21:44:45 +0200
Date: 2005-06-22T21:44:45+02:00	[thread overview]
Message-ID: <m3mzpi9nwy.fsf@0x535ddcf0.boanxx18.adsl-dhcp.tele.dk> (raw)
In-Reply-To: 1119463703.048124.135330@o13g2000cwo.googlegroups.com

"e.coli" <maurizio.ferracini@gmail.com> writes:

> here the code...
> ------------------------------------
> with Ada.Text_Io;
> with Ada.Task_Identification;
> 
> procedure Semplice2 is --processo genitore
> 
>    task Un_Task is--specifica
>       entry Uno;
>       entry Due;
>    end Un_Task;
> 
>    task body Un_Task is
>    begin
>       loop
>          select
>             accept Uno do
>                Ada.Text_Io.Put_Line("foo");
>             end Uno;
>          or
>             accept Due do
>                Ada.Text_Io.Put_Line("buffering");
>                loop           -- ;)
>                   delay(0.0);
>                end loop;
>                Ada.Text_Io.Put_Line("bar");
>             end Due;
>          end select;
>       end loop;
>    end Un_Task;
> 
> begin --corpo genitore
>    Un_Task.Uno;
>    Ada.Text_Io.Put_Line ("wait Horribly long calculation");
>    select
>       delay 5.0;
>       Ada.Text_Io.Put_Line ("Horribly long calculation abandoned");
>    then abort
>       un_task.due;
>    end select;
> end Semplice2;
> -----------------------------------------
> 
> but don't work...
> how i can do the five second time out?
> thanks

As I see it, you have a calculation that may take a long time and you
want to abandon that calculation, if some time constraint is
reached. To do it the proper "Ada-way" you will need to use an other
technique, see:

http://www.adaic.com/standards/95aarm/html/AA-9-7-4.html

- Mark Lorenzen



  parent reply	other threads:[~2005-06-22 19:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-22 18:08 task time-out&abort e.coli
2005-06-22 18:40 ` Dmitry A. Kazakov
2005-06-23 10:11   ` e.coli
2005-06-23 10:59     ` Dmitry A. Kazakov
2005-06-22 19:44 ` Mark Lorenzen [this message]
2005-06-23  1:44 ` Steve
2005-06-23 15:26 ` e.coli
2005-06-23 17:01   ` e.coli
2005-06-24 11:42     ` Marius Amado Alves
2005-06-28 21:31       ` Robert A Duff
2005-06-29  0:32         ` Marius Amado Alves
2005-06-29 20:52   ` Robert A Duff
2005-07-18 16:11     ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox