A monitor for every object

Tomek Sowiński just at ask.me
Fri Feb 4 15:06:18 PST 2011


Steven Schveighoffer napisał:

> D's monitors are lazily created, so there should be no issue with resource  
> allocation.  If you don't ever lock an object instance, it's not going to  
> consume any resources.  Most of the time the extra word isn't noticed  
> because the memory size of a class is usually not exactly a power of 2.

Except when you put'em in an array. Could happen.

> D also allows you to replace it's monitor with a custom monitor object  
> (i.e. core.sync.Mutex) so you can have more control over the mutex, assign  
> the same mutex to multiple objects, use conditions, etc.  It's much more  
> flexible than Java or C# IMO.

I didn't know, thx. Where is it documented?

-- 
Tomek



More information about the Digitalmars-d mailing list