* timed entry call doesnt timeout
@ 2002-01-14 9:10 Vincent Smeets
2002-01-14 15:05 ` Matthew Heaney
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Smeets @ 2002-01-14 9:10 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]
Hallo,
gnat 3.13p on Solaris 2.6. I have added a little demo file.
I am writing a driver for an network protocol which will send data and
wait for an acknowledgement. I have implemented it in a package (Pkt)
with a procedure interface. Inside this package, I use a protected type
and the requeue statement to implement an action with a timeout.
If I directly call the interface (Pkt.Proc) it works OK. I get the
expected timeout. But if I call the interface from an extra protected
type, then the timeout doesn't occure. The call will hang forever.
In my case, it isn't a big problem because I am writing the other parts
of the program too. But what is the correct way? If I write a package
like this and let someone else call the procedures from my package. In
that case, I can't be sure that the other programmer isn't using
protected types to call my package.
Thanks,
Vincent
--
Vincent Smeets
SchlumbergerSema -
Competence Center Informatik GmbH
Lohberg 10 - 49716 Meppen - Germany
tel: +49 5931-805-461
fax: +49 5931-805-175
mail: VSmeets@slb.com
web: www.cci.de
[-- Attachment #2: demo.adb --]
[-- Type: text/plain, Size: 1060 bytes --]
with Ada.Text_IO;
procedure Demo is
package Pkt is
procedure Proc;
end Pkt;
package body Pkt is
protected Prot is
entry Proc;
private
entry Proc_Wait;
end Prot;
protected body Prot is
entry Proc when True is
begin
Ada.Text_IO.Put_Line ("Pkt.Prot.Proc");
requeue Proc_Wait with abort;
end Proc;
entry Proc_Wait when False is
begin
Ada.Text_IO.Put_Line ("Pkt.Prot.Proc_Wait");
end Proc_Wait;
end Prot;
procedure Proc is
begin
Ada.Text_IO.Put_Line ("Pkt.Proc: start");
select
Prot.Proc;
Ada.Text_IO.Put_Line ("Pkt.Proc: Prot.Proc OK");
or
delay 1.0;
Ada.Text_IO.Put_Line ("Pkt.Proc: Prot.Proc timeout");
end select;
end Proc;
end Pkt;
protected Outside_Prot is
procedure Proc;
end Outside_Prot;
protected body Outside_Prot is
procedure Proc is
begin
Ada.Text_IO.Put_Line ("Outside_Prot.Proc: start");
Pkt.Proc;
end Proc;
end Outside_Prot;
begin
Pkt.Proc;
Outside_Prot.Proc;
end Demo;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: timed entry call doesnt timeout
2002-01-14 9:10 timed entry call doesnt timeout Vincent Smeets
@ 2002-01-14 15:05 ` Matthew Heaney
2002-01-15 6:20 ` Vincent Smeets
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Heaney @ 2002-01-14 15:05 UTC (permalink / raw)
"Vincent Smeets" <VSmeets@meppen.sema.slb.com> wrote in message
news:3C42A089.998D3EA0@meppen.sema.slb.com...
> I am writing a driver for an network protocol which will send data and
> wait for an acknowledgement. I have implemented it in a package (Pkt)
> with a procedure interface. Inside this package, I use a protected type
> and the requeue statement to implement an action with a timeout.
Why are you making "potentially blocking" calls to Text_IO from inside a
protected object?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: timed entry call doesnt timeout
2002-01-14 15:05 ` Matthew Heaney
@ 2002-01-15 6:20 ` Vincent Smeets
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Smeets @ 2002-01-15 6:20 UTC (permalink / raw)
Matthew Heaney wrote:
>
> "Vincent Smeets" <VSmeets@meppen.sema.slb.com> wrote in message
> news:3C42A089.998D3EA0@meppen.sema.slb.com...
> > I am writing a driver for an network protocol which will send data and
> > wait for an acknowledgement. I have implemented it in a package (Pkt)
> > with a procedure interface. Inside this package, I use a protected type
> > and the requeue statement to implement an action with a timeout.
>
> Why are you making "potentially blocking" calls to Text_IO from inside a
> protected object?
The call to Text_IO is just for the demostroation in my example.
The point is that you can't see the use of my timed select statement at
the outside of the package. There is no problem if it is called
externaly from the main program (it will give the timeout), but it may
not be called from a protected type (which will block forever).
--
Vincent Smeets
SchlumbergerSema -
Competence Center Informatik GmbH
Lohberg 10 - 49716 Meppen - Germany
tel: +49 5931-805-461
fax: +49 5931-805-175
mail: VSmeets@slb.com
web: www.cci.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-15 6:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-14 9:10 timed entry call doesnt timeout Vincent Smeets
2002-01-14 15:05 ` Matthew Heaney
2002-01-15 6:20 ` Vincent Smeets
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox