TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Robert I. Eachus" <[log in to unmask]>
Wed, 13 May 1998 14:40:18 -0400
text/plain (22 lines)
At 12:13 AM 5/13/98 -0500, Stanley Allen wrote:
>The single global reference count is to keep
>track of "database interface" objects.  There is
>a single count because there is one database, in
>shared memory.  The shared memory is allocated
>via OS calls when the ref count > 0, deallocated
>when the ref count = 0.

   Not the Ada way. ;-)  Seriously, if you do need to keep track of the
users of some global object, the best way is to use some sort of a list.
This way you don't have to worry about the (hopefully very rare) cases
where an object gets Finalized twice, or Finalized without complete
Initialization.  There are list structures where removing an item from a
list is atomic, and adding to and deleting from the list, and checking for
zero length are all O(1) operations.

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...