comp.lang.ada
 help / color / mirror / Atom feed
From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Re: Combining entry_call, accept_statment and terminate_statment
Date: Tue, 30 Mar 2004 22:47:27 +0000 (UTC)
Date: 2004-03-30T22:47:27+00:00	[thread overview]
Message-ID: <slrnc6ju7v.t5g.lutz@belenus.iks-jena.de> (raw)
In-Reply-To: 106jkmlj2g6ik57@corp.supernews.com

* Randy Brukardt wrote:
> "Lutz Donnerhacke" <lutz@iks-jena.de> wrote in message
>> That's exactly my current implementation. But I increased the delay and
>> noticed, that the entry_barrier of the delayed entry_call is evaluated
>> only once on startup of the timed entry call. If the barrier becomes
>> true while the delay is running, the delay is not aborted.
>>
>> A reason for this strange behavior might be a call to a protected function
>> in the entry_barrier itself.
>
> Barriers of a PO are re-evaluated whenever a protected action ends, and when
> an entry is called. A barrier which can change state without a protected
> action ending is incorrect and may not work properly.

So cascading of protected types will not work.

My incorrect version was:

   protected type Ringbuffer is
      procedure Put(data : in String);
      procedure Get(data : out Buffer; last : out Extended_Buffer_Offset;
        missed : out Absolute_Position; pos : in out Absolute_Position);
      function Is_New(pos : Absolute_Position) return Boolean;
   private
      buf : Buffer;
      start, stop : Absolute_Position := Absolute_Position'First;
   end Ringbuffer;
   
   protected type Read_Context(ringbuf : access Ringbuffer) is
      entry Get(data : out Buffer; last : out Extended_Buffer_Offset;
        missed : out Absolute_Position);
   private
      pos : Absolute_Position := Absolute_Position'First;
   end Read_Context;

   protected body Read_Context is
      entry Get(
        data : out Buffer; last : out Extended_Buffer_Offset;
        missed : out Absolute_Position
      ) when ringbuf.Is_New(pos) is
      begin
         ringbuf.Get(data, last, missed, pos);
      end Get;
   end Read_Context;



  reply	other threads:[~2004-03-30 22:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-29 19:41 Combining entry_call, accept_statment and terminate_statment Lutz Donnerhacke
2004-03-29 22:04 ` Randy Brukardt
2004-03-29 23:19   ` Mark Lorenzen
2004-03-29 23:14     ` Robert I. Eachus
2004-03-30  7:26   ` Lutz Donnerhacke
2004-03-30 20:04     ` Randy Brukardt
2004-03-30 22:47       ` Lutz Donnerhacke [this message]
2004-03-31  9:03         ` Dmitry A. Kazakov
2004-03-31  9:14           ` Lutz Donnerhacke
2004-03-31 12:22             ` Dmitry A. Kazakov
2004-03-31  6:39       ` Jean-Pierre Rosen
2004-03-30  7:29   ` Lutz Donnerhacke
2004-03-30  8:11     ` tmoran
2004-03-30 11:45     ` Lutz Donnerhacke
2004-03-30  0:33 ` James Rogers
replies disabled

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