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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,19ad05fdbf4e671f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail From: "Gene" Newsgroups: comp.lang.ada Subject: Re: Deallocating records with task type fields. Date: 10 Dec 2005 21:02:23 -0800 Organization: http://groups.google.com Message-ID: <1134273971.939868.61130@g49g2000cwa.googlegroups.com> References: <1134168554.826805.70690@g49g2000cwa.googlegroups.com> <1vb61utj75dws.gjbmfyig7vzz.dlg@40tude.net> NNTP-Posting-Host: 216.190.181.85 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1134277348 29830 127.0.0.1 (11 Dec 2005 05:02:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 11 Dec 2005 05:02:28 +0000 (UTC) In-Reply-To: <1vb61utj75dws.gjbmfyig7vzz.dlg@40tude.net> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=216.190.181.85; posting-account=ZFTPUQ0AAABW8AYEou9RtrBd-zTxz0_y Xref: g2news1.google.com comp.lang.ada:6821 Date: 2005-12-10T21:02:23-08:00 List-Id: 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.