comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: task time-out&abort
Date: Wed, 22 Jun 2005 20:40:57 +0200
Date: 2005-06-22T20:40:45+02:00	[thread overview]
Message-ID: <vdbnlli9ydje$.io7o946yz93w.dlg@40tude.net> (raw)
In-Reply-To: 1119463703.048124.135330@o13g2000cwo.googlegroups.com

On 22 Jun 2005 11:08:23 -0700, e.coli wrote:

> 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

It is not clear what you are trying to achieve. The entry point Due engages
the rendezvous and then loops there. Because looping happens during a
rendezvous both participants (Un_Task and the main task) will stay there
forever. Note that a timed entry call puts on a limit for *waiting* for a
rendezvous, it does not limit the rendezvous itself.

---
The rule of thumb: rendezvous (and protected operations) should be as short
as possible.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-06-22 18:40 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 [this message]
2005-06-23 10:11   ` e.coli
2005-06-23 10:59     ` Dmitry A. Kazakov
2005-06-22 19:44 ` Mark Lorenzen
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