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-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!indigo.octanews.net!news-out.octanews.net!mauve.octanews.net!uns-out.usenetserver.com!news.usenetserver.com!pc03.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Impossible problem? A protected buffer to queue objects of a class-wide type References: <461cc46d$1_1@glkas0286.greenlnk.net> <461cd912$1_1@glkas0286.greenlnk.net> From: Stephen Leake Date: Thu, 12 Apr 2007 04:36:11 -0400 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:L23dzSwgmU8Sik1LEH7/V5qsooY= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 16c61461def80759e00d403564 Xref: g2news1.google.com comp.lang.ada:14926 Date: 2007-04-12T04:36:11-04:00 List-Id: "Phil Slater" writes: > "Rob Norris" wrote in message > news:ilkp139uool31fc8opd7b94jpmctvndeg3@4ax.com... >> > >>>(b) To support this call, Dequeue must be written as a function. As such, >>>it >>>cannot change the protected queue. What I need is the "entry" >>>functionality, >>>since I want the Dequeue to wait if the queue is empty, and I want the >>>item >>>to be removed from the queue as well as retrieved. >> >> Quick thought: >> Is it possible to pass into the function a reference to the queue? >> Then you should be able change the content of the queue as you see fit. >> > > Maybe I didn't make myself clear. The queue is a protected object. Instead of making the queue itself a protected object, use a separate protected object as a lock for the queue. That is not quite as safe, but it will work. > None of the three types of protected operation (functions, > procedures and entries), does what I need. I need the > barrier/blocking of an entry, I need write access to change the > protected data (the queue), but I also need the operation to > *return* a value (like a function does) so that it can be received > in calling code by using it to initialise a newly declared variable > of a class-wide type. You could have a function take an access type, and allocate the user object in the protected call. But you may have reasons for not wanting to do that. -- -- Stephe