Newsgroups: comp.lang.c++.moderated
From: Joseph Seigh <jseigh...@xemaps.com>
Date: 22 Mar 2003 15:27:19 -0500
Local: Sat, Mar 22 2003 3:27 pm
Subject: Re: Implementing thread-safe shared_ptr/weak_ptr using atomic counts
I wrote: .... > n = InterlockedCompareExchange(&this.m_strongcount, cmp + 1, cmp); Umm... that should of course just be n = InterlockedCompareExchange(&m_strongcount, cmp + 1, cmp); A little bit of a mix of C pseudo objects and Java in there. I'm suprised I didn't I've been trying to come up with an all interlocked increment/decrement solution since void shared_count::add_strong() { void shared_count::release_strong() { Some comments. The exception throwing path I think is not performance critical since the If you have native interlocked increment/decrement, then this code is totally loop free. Also, you might consider packing both refcount and strongcount into the same word and Final comment to Alexander. This is why I don't think you can come up something like Joe Seigh [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||