Newbie initial comments on D language - scope

Edward Diener eddielee_no_spam_here at tropicsoft.com
Sat Feb 2 12:03:05 PST 2008


Janice Caron wrote:
> On 2/2/08, Walter Bright <newshound1 at digitalmars.com> wrote:
>> Doing locked reference counts is slow
> 
> Surely you don't need to lock the reference count? You can use atomic
> increment and atomic decrement instead. (I implemented a ref-counted
> template in C++ once, and that's what I did. It seemed to work).
> 
> Locking the indirect object itself - that's another matter! However,
> one would imagine that multithreaded code which shares objects will
> already have a mutex system in place, because that would have been
> needed even without ref counting.

Exactly ! The responsibility for object access in a multi-threading 
system is the end-user's not that of D, and the only low-level 
responsibility of D in such scheme is to manipulate the reference count 
atomically.



More information about the Digitalmars-d mailing list