comp.lang.ada
 help / color / mirror / Atom feed
From: "Gene" <gene.ressler@gmail.com>
Subject: Re: Deallocating records with task type fields.
Date: 10 Dec 2005 21:02:23 -0800
Date: 2005-12-10T21:02:23-08:00	[thread overview]
Message-ID: <1134273971.939868.61130@g49g2000cwa.googlegroups.com> (raw)
In-Reply-To: <1vb61utj75dws.gjbmfyig7vzz.dlg@40tude.net>

Many thanks.  I certainly could have picked a better of example that
Port for data.

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.

So before the current method I indeed implemented the shared queue by
passing it to the Listener with a discriminant (your 2.). Also tried a
Start entry (your 3.).  In all the method above is by far the cleanest
because the whole Listener is a single type that acts like a functional
closure.  This matter of handling deallocation when the executive task
exits is the only rough edge.

As the name implies, the application is a TCP network listener in a
multi-node graphics application.  Listeners are allocated as needed and
exit when their corresponding connections are terminated, either
normally or due to an error condition.  When this happens, we want the
Listener to arrange for its own deallocation.

Currently I just have the Executive put its enclosing Listener on a
system-wide "dead listener" queue.  There is a procedure that traverses
the queue to deallocate any listeners whose executive tasks have indeed
terminated.  This is called whenever a new Listener is allocated.  This
works fine (although it needs Real Time Extensions).  I wondered if
there was a simpler way.

In fact just for fun I also tried having the Listener call
Unchecked_Deallocation itself just before exiting (i.e. the task was
deallocating its own context!).  And with GNAT running under both
Solaris and Windows it never caused a problem.




      parent reply	other threads:[~2005-12-11  5:02 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
2005-12-11  5:02   ` Gene [this message]
replies disabled

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