From: Vincent Smeets <VSmeets@meppen.sema.slb.com>
Subject: timed entry call doesnt timeout
Date: Mon, 14 Jan 2002 10:10:33 +0100
Date: 2002-01-14T10:10:33+01:00 [thread overview]
Message-ID: <3C42A089.998D3EA0@meppen.sema.slb.com> (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;
next reply other threads:[~2002-01-14 9:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-14 9:10 Vincent Smeets [this message]
2002-01-14 15:05 ` timed entry call doesnt timeout Matthew Heaney
2002-01-15 6:20 ` Vincent Smeets
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox