A monitor for every object
Steven Schveighoffer
schveiguy at yahoo.com
Mon Feb 7 05:22:00 PST 2011
On Mon, 07 Feb 2011 07:48:53 -0500, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> The meaning of an 'object being its own monitor' is just that the
> monitor for operations on an object is conceptually the object itself
> (even though it's technically a hidden member of the object).
>
> This model has some very bad drawbacks, because it encourages you to use
> an object to lock an operation on itself when most cases, you want more
> coarse mutexes (mutexes should be tied to entire concepts, not just to
> individual objects).
>
> With D, you can alleviate this somewhat by specifying a specific monitor
> for an object.
I may be wrong on this one, it looks like from the docs a mutex can only
be assigned to exactly one object. But I've asked Sean to clarify.
-Steve
More information about the Digitalmars-d
mailing list