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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a6c65cbc407987fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-20 10:20:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: dynamic multithreading Date: 20 Nov 2002 10:20:11 -0800 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0211201020.1b031056@posting.google.com> References: NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1037816411 6784 127.0.0.1 (20 Nov 2002 18:20:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 20 Nov 2002 18:20:11 GMT Xref: archiver1.google.com comp.lang.ada:31135 Date: 2002-11-20T18:20:11+00:00 List-Id: "Grein, Christoph" wrote in message news:... > > http://www.adapower.com/alg/smartp.html > > There is another implementation of referece counted pointers, Safe_Pointers, in my home > page. This has been published in Ada Letters some years ago. > > See http://home.T-Online.de/home/Christ-Usch.Grein/Ada/ The package Charles.Access_Control provides an abstraction very similar to an auto_ptr in C++. The idea is that someone always "owns" a pointer, and it's up to the owner to Free the object. In the case of Access_Control, the Pointer_Type can be used as an owner, presumably in a temporary scope. This means that no matter how you exit the scope (say, an unhandled exception), you have a guarantee that the memory get free'd. For example: function Factory_Function return T_Access is Pointer : T_Access_Control.Pointer_Type; begin Initialize (Pointer, new T); --do some stuff that might raise an exception, etc --ok, we're all done, transfer ownership to caller return Release (Pointer); end Factory_Function; I put up a new version (20021119) of Charles last night (I added a bounded vector container, and generalized the Access_Control package): http://home.earthlink.net/~matthewjheaney/charles/index.html