Changeset 25844 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jan 14, 2010 7:47:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r25833 r25844 37 37 #include <iprt/asm.h> 38 38 #include <iprt/assert.h> 39 #include <iprt/env.h> 39 40 #include <iprt/err.h> 40 41 #include <iprt/mem.h> … … 240 241 */ 241 242 static RTSEMXROADS g_hLockValidatorXRoads = NIL_RTSEMXROADS; 243 /** Serializing class tree insert and lookups. */ 244 static RTSEMRW g_hLockValClassTreeRWLock= NIL_RTSEMRW; 245 /** Class tree. */ 246 static PAVLLU32NODECORE g_LockValClassTree = NULL; 247 /** Critical section serializing the teaching new rules to the classes. */ 248 static RTCRITSECT g_LockValClassTeachCS; 249 242 250 /** Whether the lock validator is enabled or disabled. 243 251 * Only applies to new locks. */ … … 255 263 static bool volatile g_fLockValidatorMayPanic = false; 256 264 #endif 257 /** Serializing class tree insert and lookups. */ 258 static RTSEMRW g_hLockValClassTreeRWLock= NIL_RTSEMRW; 259 /** Class tree. */ 260 static PAVLLU32NODECORE g_LockValClassTree = NULL; 261 /** Critical section serializing the teaching new rules to the classes. */ 262 static RTCRITSECT g_LockValClassTeachCS; 265 /** Whether to return an error status on wrong locking order. */ 266 static bool volatile g_fLockValSoftWrongOrder = false; 263 267 264 268 … … 278 282 if (ASMAtomicCmpXchgU32(&s_fInitializing, true, false)) 279 283 { 284 /* 285 * The locks. 286 */ 280 287 if (!RTCritSectIsInitialized(&g_LockValClassTeachCS)) 281 288 RTCritSectInitEx(&g_LockValClassTeachCS, RTCRITSECT_FLAGS_NO_LOCK_VAL, NIL_RTLOCKVALCLASS, … … 298 305 } 299 306 307 #ifdef IN_RING3 308 /* 309 * Check the environment for our config variables. 310 */ 311 if (RTEnvExist("IPRT_LOCK_VALIDATOR_ENABLED")) 312 ASMAtomicWriteBool(&g_fLockValidatorEnabled, true); 313 if (RTEnvExist("IPRT_LOCK_VALIDATOR_DISABLED")) 314 ASMAtomicWriteBool(&g_fLockValidatorEnabled, false); 315 316 if (RTEnvExist("IPRT_LOCK_VALIDATOR_MAY_PANIC")) 317 ASMAtomicWriteBool(&g_fLockValidatorMayPanic, true); 318 if (RTEnvExist("IPRT_LOCK_VALIDATOR_MAY_NOT_PANIC")) 319 ASMAtomicWriteBool(&g_fLockValidatorMayPanic, false); 320 321 if (RTEnvExist("IPRT_LOCK_VALIDATOR_NOT_QUIET")) 322 ASMAtomicWriteBool(&g_fLockValidatorQuiet, false); 323 if (RTEnvExist("IPRT_LOCK_VALIDATOR_QUIET")) 324 ASMAtomicWriteBool(&g_fLockValidatorQuiet, true); 325 326 if (RTEnvExist("IPRT_LOCK_VALIDATOR_STRICT_ORDER")) 327 ASMAtomicWriteBool(&g_fLockValSoftWrongOrder, false); 328 if (RTEnvExist("IPRT_LOCK_VALIDATOR_SOFT_ORDER")) 329 ASMAtomicWriteBool(&g_fLockValSoftWrongOrder, true); 330 #endif 331 332 /* 333 * Register cleanup 334 */ 300 335 /** @todo register some cleanup callback if we care. */ 301 336 … … 1448 1483 } 1449 1484 else 1450 rc = VERR_SEM_LV_WRONG_ORDER;1485 rc = !g_fLockValSoftWrongOrder ? VERR_SEM_LV_WRONG_ORDER : VINF_SUCCESS; 1451 1486 1452 1487 if (RT_SUCCESS(rcLock)) … … 2133 2168 rtLockValComplainAboutLockStack(pThreadSelf, 0, 0, pRec2); 2134 2169 rtLockValComplainPanic(); 2135 return VERR_SEM_LV_WRONG_ORDER;2170 return !g_fLockValSoftWrongOrder ? VERR_SEM_LV_WRONG_ORDER : VINF_SUCCESS; 2136 2171 } 2137 2172 … … 2442 2477 rtLockValComplainFirst("Wrong release order!", NULL, pThreadSelf, pRec, true); 2443 2478 rtLockValComplainPanic(); 2444 return VERR_SEM_LV_WRONG_RELEASE_ORDER;2479 return !g_fLockValSoftWrongOrder ? VERR_SEM_LV_WRONG_RELEASE_ORDER : VINF_SUCCESS; 2445 2480 } 2446 2481
Note:
See TracChangeset
for help on using the changeset viewer.