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!wns13feed!worldnet.att.net!attbi_s53.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: copy constructor for sockets References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 24.6.132.82 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s53 1085376056 24.6.132.82 (Mon, 24 May 2004 05:20:56 GMT) NNTP-Posting-Date: Mon, 24 May 2004 05:20:56 GMT Organization: Comcast Online Date: Mon, 24 May 2004 05:20:56 GMT Xref: controlnews3.google.com comp.lang.ada:795 Date: 2004-05-24T05:20:56+00:00 List-Id: >I have it stuck in my head that Finalize can get called more than >once. Which would make a mockery of (simple-minded) reference counting If each copy of the socket points to the single shared ref count (Rep_Type here), then Finalize may be called as often as you want on the socket: the first time it's called it decrements the shared reference count, frees the Rep_Type if the count is now zero, and nulls the socket's pointer. Subsequent calls on the same socket see that the pointer is null and there's nothing to do.