Steven Schveighoffer Wrote:

> On Mon, 07 Feb 2011 10:33:29 -0500, Robert Jacques <[email protected]>  
> wrote:
> >
> > Steve, you can always assign to an object's monitor variable manually.  
> > But adding this functionality to Mutex's and Object's API would be  
> > appreciated.
> 
> Sure, Mutex does this already.  What I was simply asking is if it will  
> blow up or not :)

It'll work fine, so long as the monitor is a Mutex.  If you want to share the 
default monitor, that will require some work, because the instance is manually 
allocated.  Oh, another issue with using Mutex as an object monitor is that 
it's allocated on the GC heap, so a synchronized block in the object's dtor 
could fail.  All the usual workarounds apply--just something to be aware of.

Reply via email to