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,d0728b52f51f685e X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!gnilink.net!bigfeed2.bellsouth.net!news.bellsouth.net!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: copy constructor for sockets References: From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 24 May 2004 03:23:25 GMT NNTP-Posting-Host: 64.185.133.124 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1085369005 64.185.133.124 (Sun, 23 May 2004 20:23:25 PDT) NNTP-Posting-Date: Sun, 23 May 2004 20:23:25 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: controlnews3.google.com comp.lang.ada:793 Date: 2004-05-24T03:23:25+00:00 List-Id: "Marius Amado Alves" 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.