comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@on2.com (Matthew Heaney)
Subject: Re: dynamic multithreading
Date: 20 Nov 2002 10:20:11 -0800
Date: 2002-11-20T18:20:11+00:00	[thread overview]
Message-ID: <1ec946d1.0211201020.1b031056@posting.google.com> (raw)
In-Reply-To: mailman.1037689022.2833.comp.lang.ada@ada.eu.org

"Grein, Christoph" <christoph.grein@eurocopter.com> wrote in message news:<mailman.1037689022.2833.comp.lang.ada@ada.eu.org>...
> > 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



  reply	other threads:[~2002-11-20 18:20 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-19  6:49 dynamic multithreading Grein, Christoph
2002-11-20 18:20 ` Matthew Heaney [this message]
2002-11-27 15:55 ` John English
  -- strict thread matches above, loose matches on Subject: below --
2002-11-19  6:46 Grein, Christoph
2002-11-19  6:38 Grein, Christoph
2002-11-19  9:13 ` Lutz Donnerhacke
2002-11-19  5:28 Grein, Christoph
2002-11-18 12:13 Grein, Christoph
2002-11-18 13:38 ` Dmitry A. Kazakov
2002-11-18  9:22 Grein, Christoph
2002-11-18 12:25 ` Thierry Lelegard
2002-11-18 13:32   ` Dmitry A. Kazakov
2002-11-18 16:20     ` Pascal Obry
2002-11-14 13:12 Artiom Ivanov
2002-11-14 13:49 ` David Marceau
2002-11-14 14:14 ` Björn Lundin
2002-11-14 17:07   ` Thierry Lelegard
2002-11-14 18:59     ` tmoran
2002-11-14 22:04       ` Robert A Duff
2002-11-15  9:27       ` Jean-Pierre Rosen
2002-11-17 23:02     ` AG
2002-11-17  5:17       ` tmoran
2002-11-17 12:40       ` Simon Wright
2002-11-18  9:11       ` Thierry Lelegard
2002-11-18 12:12         ` Dmitry A. Kazakov
2002-11-18 16:18           ` Pascal Obry
2002-11-18 16:25             ` Lutz Donnerhacke
2002-11-18 16:21               ` Simon Wright
2002-11-19  9:03                 ` Lutz Donnerhacke
2002-11-19 21:41                   ` Simon Wright
2002-11-18 16:28               ` Preben Randhol
2002-11-18 16:30                 ` Lutz Donnerhacke
2002-11-18 16:35                   ` Preben Randhol
2002-11-18 16:44                     ` Lutz Donnerhacke
2002-11-18 18:58                       ` Preben Randhol
2002-11-19  9:09                         ` Lutz Donnerhacke
2002-11-18 19:00                       ` Preben Randhol
2002-11-19  9:11                         ` Lutz Donnerhacke
2002-11-19  9:32                           ` Preben Randhol
2002-11-19 11:18                             ` Lutz Donnerhacke
2002-11-19 12:42                       ` Georg Bauhaus
2002-11-19  9:00             ` Dmitry A. Kazakov
2002-11-18 14:30       ` Stephen Leake
2002-11-18 17:41         ` David C. Hoos
2002-11-14 14:29 ` David C. Hoos
2002-11-14 18:37 ` Jeffrey Carter
2002-11-14 22:03 ` Robert A Duff
replies disabled

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