Changeset 8649 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- May 7, 2008 12:04:03 PM (17 years ago)
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r8245 r8649 35 35 #include <iprt/assert.h> 36 36 #include <iprt/alloc.h> 37 #include <iprt/thread.h> 37 38 #include <iprt/asm.h> 38 39 #include <iprt/err.h> … … 42 43 #include <unistd.h> 43 44 #include <sys/time.h> 45 46 47 /******************************************************************************* 48 * Defined Constants And Macros * 49 *******************************************************************************/ 50 /** @def RTSEMMUTEX_STRICT 51 * Enables strictness checks and lock accounting. 52 */ 53 #ifndef RTSEMMUTEX_STRICT 54 # if defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT) || defined(DOXYGEN_RUNNING) 55 # define RTSEMMUTEX_STRICT 56 # endif 57 #endif 44 58 45 59 … … 67 81 * @param pIntMutexSem Pointer to the mutex semaphore to validate. 68 82 */ 69 inline boolrtsemMutexValid(struct RTSEMMUTEXINTERNAL *pIntMutexSem)83 DECLINLINE(bool) rtsemMutexValid(struct RTSEMMUTEXINTERNAL *pIntMutexSem) 70 84 { 71 85 if ((uintptr_t)pIntMutexSem < 0x10000) … … 224 238 pIntMutexSem->Owner = Self; 225 239 ASMAtomicXchgU32(&pIntMutexSem->cNesting, 1); 240 #ifdef RTSEMMUTEX_STRICT 241 RTTHREAD Thread = RTThreadSelf(); 242 if (Thread != NIL_RTTHREAD) 243 RTThreadWriteLockInc(Thread); 244 #endif 226 245 227 246 return VINF_SUCCESS; … … 272 291 * Clear the state. (cNesting == 1) 273 292 */ 293 #ifdef RTSEMMUTEX_STRICT 294 RTTHREAD Thread = RTThreadSelf(); 295 if (Thread != NIL_RTTHREAD) 296 RTThreadWriteLockDec(Thread); 297 #endif 274 298 pIntMutexSem->Owner = (pthread_t)-1; 275 299 ASMAtomicXchgU32(&pIntMutexSem->cNesting, 0); -
trunk/src/VBox/Runtime/r3/win/sems-win.cpp
r8245 r8649 37 37 38 38 #include <iprt/semaphore.h> 39 #include <iprt/thread.h> 39 40 #include <iprt/assert.h> 40 41 #include <iprt/err.h> 41 42 43 44 /******************************************************************************* 45 * Defined Constants And Macros * 46 *******************************************************************************/ 47 /** @def RTSEMMUTEX_STRICT 48 * Enables strictness checks and lock accounting. 49 */ 50 #ifndef RTSEMMUTEX_STRICT 51 # if defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT) || defined(DOXYGEN_RUNNING) 52 # define RTSEMMUTEX_STRICT 53 # endif 54 #endif 42 55 43 56 /** Converts semaphore to win32 handle. */ … … 230 243 switch (rc) 231 244 { 232 case WAIT_OBJECT_0: return VINF_SUCCESS; 245 case WAIT_OBJECT_0: 246 { 247 #ifdef RTSEMMUTEX_STRICT 248 RTTHREAD Thread = RTThreadSelf(); 249 if (Thread != NIL_RTTHREAD) 250 RTThreadWriteLockInc(Thread); 251 #endif 252 return VINF_SUCCESS; 253 } 254 233 255 case WAIT_TIMEOUT: return VERR_TIMEOUT; 234 256 case WAIT_IO_COMPLETION: return VERR_INTERRUPTED; … … 252 274 * Unlock mutex semaphore. 253 275 */ 276 #ifdef RTSEMMUTEX_STRICT 277 RTTHREAD Thread = RTThreadSelf(); 278 if (Thread != NIL_RTTHREAD) 279 RTThreadWriteLockDec(Thread); 280 #endif 254 281 if (ReleaseMutex(SEM2HND(MutexSem))) 255 282 return VINF_SUCCESS; 283 284 #ifdef RTSEMMUTEX_STRICT 285 if (Thread != NIL_RTTHREAD) 286 RTThreadWriteLockInc(Thread); 287 #endif 256 288 AssertMsgFailed(("Release MutexSem %p failed, lasterr=%d\n", MutexSem, GetLastError())); 257 289 return RTErrConvertFromWin32(GetLastError());
Note:
See TracChangeset
for help on using the changeset viewer.