From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,78546269947cb927 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-31 01:14:13 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!newsfeed.stueberl.de!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Combining entry_call, accept_statment and terminate_statment Date: Wed, 31 Mar 2004 09:14:12 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <106h7clrs4iio8c@corp.supernews.com> <106jkmlj2g6ik57@corp.supernews.com> <4ttk60parnsdj19c34pi38p94uc2rnkj4h@4ax.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1080724452 5483 217.17.192.37 (31 Mar 2004 09:14:12 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Wed, 31 Mar 2004 09:14:12 +0000 (UTC) User-Agent: slrn/0.9.8.0 (Linux) Xref: archiver1.google.com comp.lang.ada:6686 Date: 2004-03-31T09:14:12+00:00 List-Id: * Dmitry A Kazakov wrote: > On Tue, 30 Mar 2004 22:47:27 +0000 (UTC), Lutz Donnerhacke >>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; > > Ringbuffer.Get(...); in Read_Context is an external call, so it should > start a new protected action, which would lead to re-evaluating the > barriers of ringbuf.all. There are no barriers on Ringbuffer. The only barrier is on Read_Context. And the barrier is neither reevaluated on a call to Ringbuffer.Put nor polled. > So Read_Context.Get would result in re-evaluation of the barriers of both > objects. Read_Context.Get is never called after the first evaluation of the barrier. The barrier is never reevaluated. So the system blocked forever. > However, I cannot say if ringbuf.Is_New will be called during a > re-evaluation of the barriers of Read_Context. It will, but there is no reevaluated at all. > But surely it won't, if ringbuff is touched from outside. Ack. > [ tagged protected object could be very useful in cases like this. > Mix-in works poorly here. ] Tagging doesn't provide anything useful in this context. Please do not mix orthogonal concepts. Entry families does provide the required behavior: An entry family call has two formal argument lists. The first one is evaluated before the barrier and therefor usable in the barrier itself. (That's the real issue on entry families.) The second one is evaluated after the barrier is evaluated to True.