Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3932

Show
Ignore:
Timestamp:
09/09/08 14:57:54 (2 months ago)
Author:
sean
Message:

Added new ctor to Mutex that allows it to be automatically applied as the monitor for an existing object. This closes #1282

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/core/sync/Mutex.d

    r2809 r3932  
    6161        } 
    6262        m_proxy.link = this; 
     63        // NOTE: With DMD this can be "this.__monitor = &m_proxy". 
    6364        (cast(void**) this)[1] = &m_proxy; 
     65    } 
     66 
     67 
     68    /** 
     69     * Initializes a mutex object and sets it as the monitor for o. 
     70     * 
     71     * In: 
     72     *  o must not already have a monitor. 
     73     */ 
     74    this( Object o ) 
     75    in 
     76    { 
     77        // NOTE: With DMD this can be "o.__monitor is null". 
     78        assert( (cast(void**) o)[1] is null ); 
     79    } 
     80    body 
     81    { 
     82        this(); 
     83        // NOTE: With DMD this can be "o.__monitor = &m_proxy". 
     84        (cast(void**) o)[1] = &m_proxy; 
    6485    } 
    6586