From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-05-23 09:47:43


Alexander Terekhov wrote:
> < 2 x Forward Inline >
[snip]
> There's no COW semantics here. It's rather simple, really. Any
> operation that "updates" the use-count needs to be synchronized
> with respect to other readers/writers. The basic thread safety
> is pretty much the same stuff as POSIX's memory synchronization
> rules stated in 4.10/Base Definitions volume. Note that things
> like semas and pthread_refcount_t provide STRONG thread-safety
> (for themselves; from "OO" point of view, if you look at their
> interface); well, with some "exceptions"... please take a look
> at pthread_refcount_setvalue().
>
I'm a newbie, so this might seem a simple question: Wouldn't
weighted reference counts eliminate around half the synchronization.
This is because, AFAICT, the only time synchronization is needed is
when a smart weighted pointer releases it's pointee, but not
when it acquires a new pointee (because the reference count is
gotten from the other, or source, smart weighted pointer).