comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Deallocating records with task type fields.
Date: Mon, 12 Dec 2005 16:03:52 -0600
Date: 2005-12-12T16:03:52-06:00	[thread overview]
Message-ID: <fKidndwyzcRebwDeRVn-vA@megapath.net> (raw)
In-Reply-To: 1134274006.711602.173280@g43g2000cwa.googlegroups.com

"Gene" <gene.ressler@gmail.com> wrote in message
news:1134274006.711602.173280@g43g2000cwa.googlegroups.com...
...
> In fact the real environment record also has a protected output queue
> with procedures to get data from the queue that the Listener has placed
> there.  That's the interesting case because other tasks need to call
> functions that can touch the queue.  I couldn't see a good way to
> declare the queue on the task stack and yet allow other tasks to get
> things from it.

An idea for the future (Ada 200Y) - use a protected interface and an access
to it. You'd still need to manage the pointer in some way (so it doesn't
dangle - you'll have to use 'Unchecked_Access to create the pointer), but it
would let you put the primary object inside of the task.

Indeed, you probably can do this with an access-to-protected-type, too
(presuming the objects are all the same type). Tasks that need to use the
protected queue would call an entry to get the access-to-protected-object,
then they could reference the queue normally via the access. If the callers
don't copy the access, you don't even need any real management of the
pointers (they call to the entry ensures that the queue exists).

This is far from my favorite approach, but it at least has good storage
management behavior. And it's probably better than twisting yourself in
knots to get storage management of separate entities tied together.

                               Randy.







  parent reply	other threads:[~2005-12-12 22:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-09 22:49 Deallocating records with task type fields Gene
2005-12-10  7:16 ` Jeffrey R. Carter
2005-12-10 11:45   ` Simon Wright
2005-12-10 14:10 ` Dmitry A. Kazakov
2005-12-11  4:06   ` Gene
2005-12-11 11:50     ` Dmitry A. Kazakov
2005-12-12 11:32       ` Alex R. Mosteo
2005-12-12 18:30         ` Pascal Obry
2005-12-13 10:22           ` Alex R. Mosteo
2005-12-12 22:03     ` Randy Brukardt [this message]
2005-12-11  5:02   ` Gene
replies disabled

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