comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Impossible problem? A protected buffer to queue objects of a class-wide type
Date: Thu, 12 Apr 2007 04:36:11 -0400
Date: 2007-04-12T04:36:11-04:00	[thread overview]
Message-ID: <uy7kyng5g.fsf@stephe-leake.org> (raw)
In-Reply-To: 461cd912$1_1@glkas0286.greenlnk.net

"Phil Slater" <phil.slater@baesystems.com> writes:

> "Rob Norris" <firstname.lastname@baesystems.com> 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



  reply	other threads:[~2007-04-12  8:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-11 11:34 Impossible problem? A protected buffer to queue objects of a class-wide type Phil Slater
2007-04-11 12:25 ` Rob Norris
2007-04-11 13:02   ` Phil Slater
2007-04-12  8:36     ` Stephen Leake [this message]
2007-04-11 13:14 ` Dmitry A. Kazakov
2007-04-11 14:01 ` Jean-Pierre Rosen
2007-04-11 17:18 ` tmoran
2007-04-13 17:02 ` Matthew Heaney
2007-04-13 17:26   ` Matthew Heaney
2007-04-13 17:36   ` Ed Falis
replies disabled

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