Changeset 783
- Timestamp:
- 07/04/08 22:23:48 (2 months ago)
- Files:
-
- trunk/phobos/internal/monitor.d (modified) (2 diffs)
- trunk/phobos/internal/object.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/internal/monitor.d
r781 r783 176 176 } 177 177 178 void escalateLock(Object obj) 179 { 180 __monitor_mutex.lock; 181 if (GetFatLock(obj) is null) 182 SetFatLock(obj, conStruct!(FatLock)); 183 __monitor_mutex.unlock; 184 } 185 178 186 /** Called only once by a single thread during startup */ 179 187 extern(C) void _STI_monitor_staticctor() … … 198 206 // Warning: data race 199 207 if (GetFatLock(obj) is null) 200 { 201 __monitor_mutex.lock; 202 if (GetFatLock(obj) is null) // if, in the meantime, another thread didn't set it 203 { 204 SetFatLock(obj, conStruct!(FatLock)); 205 } 206 __monitor_mutex.unlock; 207 } 208 escalateLock(obj); 209 208 210 GetFatLock(obj).lock; 209 211 } trunk/phobos/internal/object.d
r781 r783 141 141 { 142 142 //printf("notifyRegister(dg = %llx, o = %p)\n", dg, this); 143 if (!GetFatLock(this)) 144 escalateLock(this); // Fat lock stores delegates 143 145 synchronized (this) 144 146 { 145 // Important: Monitor is guaranteed to be initialized146 // as the side-effect of the synchronized clause above147 147 FatLock * fatLock = GetFatLock(this); 148 148 assert(fatLock);
