Refcounting smart pointer?

Jb jb at nowhere.com
Fri Sep 5 07:16:05 PDT 2008


"Sönke Ludwig" <ludwig_no at spam_informatik.uni-luebeck.de> wrote in message 
news:g9nvrs$284k$1 at digitalmars.com...
>
> On the other side, making a completely thread-safe variant is not possible 
> as far as I see, since the copy operation is not safe - so only the 
> reference counting part can really be made safe.

Thread safe ref counting can be done with

lock inc [this.refcount]
lock dec [this.refcount]

You need the lock prefix or else they are not atomic.







More information about the Digitalmars-d mailing list