Locking on an object...
        Posted  
        
            by Mystere Man
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Mystere Man
        
        
        
        Published on 2010-06-05T06:39:41Z
        Indexed on 
            2010/06/05
            6:42 UTC
        
        
        Read the original article
        Hit count: 492
        
I often see code like that which is shown here, ie where an object is allocated and then used as a "lock object".
It seems to me that you could use any object for this, including the event itself as the lock object. Why allocate a new object that does nothing? My understanding is that calling lock() on an object doesn't actually alter the object itself, nor does it actually lock it from being used, it's simply used as a placeholder for multiple lock statements to anchor on.
So my question is, is this really a good thing to do?
© Stack Overflow or respective owner