comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: copy constructor for sockets
Date: Mon, 24 May 2004 03:23:25 GMT
Date: 2004-05-24T03:23:25+00:00	[thread overview]
Message-ID: <usmdq1jm4.fsf@earthlink.net> (raw)
In-Reply-To: mailman.13.1085350603.401.comp.lang.ada@ada-france.org

"Marius Amado Alves" <amado.alves@netcabo.pt> writes:

> > ... during Adjust you increment the refcount of the socket.  You
> > decrement the refcount during Finalize.
> 
> Right. Now you only have to know how many times Finalize gets called,

Why?  When the refcount goes to zero, then the last of the socket
objects attached to that handle have been finalized, and you can
deallocate handle.  What's the problem?


> where from,

Why?  The whole point of using reference counting is to be able to
ignore when and by whom, because it is the socket object itself that
controls when the handle is closed.


> in which of these times you should decrement,

Huh?  Every time, of course.  How could it be otherwise?  What would a
reference counting scheme even mean, if you didn't decrement the
refcount during finalization of the object?


> and declare all sockets at library level.

Huh?  The sockets package is declared at library level, but socket
objects can be declared anywhere, at any level.


> A nice Rube Goldberg machine. Don't you just love the Ada way?

I'm not sure what you mean by "Ada way."  The code I described in my
last post was pseudo-code, translated from C++ code.  The reference
counting scheme I described is the same in either language.




  reply	other threads:[~2004-05-24  3:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-22 10:19 copy constructor for sockets Andrew Carroll
2004-05-22 11:55 ` Simon Wright
2004-05-22 18:39   ` tmoran
2004-05-23 21:04   ` Matthew Heaney
2004-05-24  7:13     ` Marius Amado Alves
2004-05-24  3:23       ` Matthew Heaney [this message]
2004-05-24  4:53         ` Simon Wright
2004-05-24  5:20           ` tmoran
2004-05-25  4:53             ` Simon Wright
2004-05-24 12:36           ` Matthew Heaney
2004-05-25 21:50           ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
2004-05-22 21:18 Andrew Carroll
2004-05-22 21:46 ` tmoran
2004-05-23 11:21   ` Simon Wright
2004-05-24 18:26     ` tmoran
2004-05-25  5:10       ` Simon Wright
2004-05-25  6:37         ` tmoran
2004-05-23  9:43 ` Mark Lorenzen
2004-05-23 11:27 ` Simon Wright
2004-05-24 11:28 Andrew Carroll
2004-05-25  5:29 ` Simon Wright
replies disabled

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