Changeset 21549 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 13, 2009 4:28:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/log/log.cpp
r21396 r21549 198 198 * Locks the logger instance. 199 199 * 200 * @returns See RTSem FastMutexRequest().200 * @returns See RTSemSpinMutexRequest(). 201 201 * @param pLogger The logger instance. 202 202 */ … … 204 204 { 205 205 #ifndef IN_RC 206 if (pLogger->MutexSem != NIL_RTSEMFASTMUTEX) 207 { 208 int rc; 209 # if defined(IN_RING0) \ 210 && (defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)) 211 if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 212 return VERR_PREEMPT_DISABLED; 213 # endif 214 rc = RTSemFastMutexRequest(pLogger->MutexSem); 206 if (pLogger->hSpinMtx != NIL_RTSEMSPINMUTEX) 207 { 208 int rc = RTSemSpinMutexRequest(pLogger->hSpinMtx); 215 209 if (RT_FAILURE(rc)) 216 210 return rc; … … 228 222 { 229 223 #ifndef IN_RC 230 if (pLogger-> MutexSem!= NIL_RTSEMFASTMUTEX)231 RTSem FastMutexRelease(pLogger->MutexSem);224 if (pLogger->hSpinMtx != NIL_RTSEMFASTMUTEX) 225 RTSemSpinMutexRelease(pLogger->hSpinMtx); 232 226 #endif 233 227 return; … … 407 401 if (RT_SUCCESS(rc)) 408 402 { 409 rc = RTSem FastMutexCreate(&pLogger->MutexSem);403 rc = RTSemSpinMutexCreate(&pLogger->hSpinMtx, RTSEMSPINMUTEX_FLAGS_IRQ_SAFE); 410 404 if (RT_SUCCESS(rc)) 411 405 { … … 415 409 { 416 410 int32_t c = RTThreadGetWriteLockCount(Thread); 417 RTSem FastMutexRequest(pLogger->MutexSem);411 RTSemSpinMutexRequest(pLogger->hSpinMtx); 418 412 c = RTThreadGetWriteLockCount(Thread) - c; 419 RTSem FastMutexRelease(pLogger->MutexSem);413 RTSemSpinMutexRelease(pLogger->hSpinMtx); 420 414 ASMAtomicWriteU32(&g_cLoggerLockCount, c); 421 415 } … … 528 522 RTDECL(int) RTLogDestroy(PRTLOGGER pLogger) 529 523 { 530 int rc;531 uint32_t iGroup;532 RTSEM FASTMUTEX MutexSem;524 int rc; 525 uint32_t iGroup; 526 RTSEMSPINMUTEX hSpinMtx; 533 527 534 528 /* … … 544 538 */ 545 539 rc = rtlogLock(pLogger); 546 AssertMsgR eturn(RT_SUCCESS(rc) || rc == VERR_PREEMPT_DISABLED, ("%Rrc\n", rc), rc);540 AssertMsgRCReturn(rc, ("%Rrc\n", rc), rc); 547 541 548 542 pLogger->fFlags |= RTLOGFLAGS_DISABLED; … … 573 567 * Free the mutex, the wrapper and the instance memory. 574 568 */ 575 MutexSem = pLogger->MutexSem;576 pLogger-> MutexSem = NIL_RTSEMFASTMUTEX;577 if ( MutexSem != NIL_RTSEMFASTMUTEX)569 hSpinMtx = pLogger->hSpinMtx; 570 pLogger->hSpinMtx = NIL_RTSEMSPINMUTEX; 571 if (hSpinMtx != NIL_RTSEMSPINMUTEX) 578 572 { 579 573 int rc2; 580 RTSem FastMutexRelease(MutexSem);581 rc2 = RTSem FastMutexDestroy(MutexSem);574 RTSemSpinMutexRelease(hSpinMtx); 575 rc2 = RTSemSpinMutexDestroy(hSpinMtx); 582 576 AssertRC(rc2); 583 577 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) … … 769 763 pLogger->pfnLogger = pfnLogger; 770 764 pLogger->pfnFlush = pfnFlush; 771 pLogger-> MutexSem = NIL_RTSEMFASTMUTEX; /* Not serialized. */765 pLogger->hSpinMtx = NIL_RTSEMSPINMUTEX; /* Not serialized. */ 772 766 pLogger->u32Magic = RTLOGGER_MAGIC; 773 767 pLogger->fFlags = fFlags;
Note:
See TracChangeset
for help on using the changeset viewer.