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-Thread: 103376,a31b00ad713d92f9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!proxad.net!news.in2p3.fr!in2p3.fr!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Impossible problem? A protected buffer to queue objects of a class-wide type Date: Wed, 11 Apr 2007 16:01:37 +0200 Organization: Adalog Message-ID: <8opive.1c3.ln@hunter.axlog.fr> References: <461cc46d$1_1@glkas0286.greenlnk.net> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1176303662 14947 195.25.228.57 (11 Apr 2007 15:01:02 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Wed, 11 Apr 2007 15:01:02 +0000 (UTC) User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) In-Reply-To: <461cc46d$1_1@glkas0286.greenlnk.net> Xref: g2news1.google.com comp.lang.ada:14911 Date: 2007-04-11T16:01:37+02:00 List-Id: Phil Slater a �crit : > I've hit a brick wall. Every strategy I try doesn't work. > > I need to write a generic package that exports a protected queue type that > will act as a buffer for objects of a class-wide type. [...] Interesting question ;-) It should be solvable by separating the buffer from the protection, i.e. keep a protected object just as a lock, and provide operations that take the lock, do whatever is needed (possibly with several calls), then release the lock. Don't forget to have a "when others" exception handler to release the lock in case of an unexpected exception. This should be quite easy to do if the buffer is the package (i.e. an abstract state machine). If you need to make the buffer an abstract data type, you'll have to put the protected object as a component of the record. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr