* Timeout or agreement
@ 2002-03-12 0:32 Meresup
2002-03-12 0:58 ` may i be more explicit? Meresup
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Meresup @ 2002-03-12 0:32 UTC (permalink / raw)
My problem is to wait for the agreement of a sub routine or raise an
response_error exception on timeout. It's so easy to do it with logical
programming that I don't see the way to do it in a sequential programm. Can
u help?
Explanation :
I send a data to serial port
I'd like to wait for the OK flag of the called procedure or a timeout.
What could be the correct structure????????
^ permalink raw reply [flat|nested] 5+ messages in thread
* may i be more explicit?
2002-03-12 0:32 Timeout or agreement Meresup
@ 2002-03-12 0:58 ` Meresup
2002-03-12 1:50 ` tmoran
2002-03-12 1:38 ` Timeout or agreement Patrick Hohmeyer
2002-03-12 17:18 ` Meresup
2 siblings, 1 reply; 5+ messages in thread
From: Meresup @ 2002-03-12 0:58 UTC (permalink / raw)
I can try.
Here's what i'm trying to do :
procedure Test_Timeout is
-- Timeout
function Timeout return Boolean is
begin
delay 10.0;
return True;
end Timeout;
-- Simulation of waiting a response from a procedure
function Ar return Boolean is
begin
for I in 1..10 loop
Put (I);
delay 0.2;
end loop;
return True;
end Ar;
begin
Put("Test de timeout");
-- What can i do to go out this test as soon as any of these conditions are
true?
if Ar or Timeout then
Put (" Timeout atteint");
end if;
end Test_Timeout;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Timeout or agreement
2002-03-12 0:32 Timeout or agreement Meresup
2002-03-12 0:58 ` may i be more explicit? Meresup
@ 2002-03-12 1:38 ` Patrick Hohmeyer
2002-03-12 17:18 ` Meresup
2 siblings, 0 replies; 5+ messages in thread
From: Patrick Hohmeyer @ 2002-03-12 1:38 UTC (permalink / raw)
And Meresup wrote :
> My problem is to wait for the agreement of a sub routine or raise an
> response_error exception on timeout. It's so easy to do it with logical
> programming that I don't see the way to do it in a sequential programm.
> Can u help?
>
> Explanation :
> I send a data to serial port
> I'd like to wait for the OK flag of the called procedure or a timeout.
> What could be the correct structure????????
TASK, what you need is a task.
To do what you want you need a second thread or process (always).
Your logical language seems to encapsulate the thread creation for you,
in Ada you need to define a task or a task type.
This is a rather complicated matter, so search yourself a book /
online tutorial about it.
Another word :
As you probably want to stop the thread waiting on the serial port,
you may run into problems.
Stopping a task in the middle of it's execution can leave the
system in an inconsistent state, so be sure to find a *very* *good*
exemple befor doing it.
Have fun ;-)
--
Patrick Hohmeyer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: may i be more explicit?
2002-03-12 0:58 ` may i be more explicit? Meresup
@ 2002-03-12 1:50 ` tmoran
0 siblings, 0 replies; 5+ messages in thread
From: tmoran @ 2002-03-12 1:50 UTC (permalink / raw)
You want Ada tasking, in particular the "selective accept".
select
accept Ar_is_done;
Put("Ar finished");
or delay 10.0;
Put("Timed out");
end select;
Put("either AR finished or we timed out");
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Timeout or agreement
2002-03-12 0:32 Timeout or agreement Meresup
2002-03-12 0:58 ` may i be more explicit? Meresup
2002-03-12 1:38 ` Timeout or agreement Patrick Hohmeyer
@ 2002-03-12 17:18 ` Meresup
2 siblings, 0 replies; 5+ messages in thread
From: Meresup @ 2002-03-12 17:18 UTC (permalink / raw)
Thanks a lot everybody!!!!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-03-12 17:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-12 0:32 Timeout or agreement Meresup
2002-03-12 0:58 ` may i be more explicit? Meresup
2002-03-12 1:50 ` tmoran
2002-03-12 1:38 ` Timeout or agreement Patrick Hohmeyer
2002-03-12 17:18 ` Meresup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox