Changeset 96810 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Sep 21, 2022 12:53:43 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/log/log.cpp
r96448 r96810 465 465 DECL_NO_INLINE(static, PRTLOGGER) rtLogDefaultInstanceCreateNew(void) 466 466 { 467 PRTLOGGER pRet = RTLogDefaultInit(); 468 if (pRet) 469 { 470 bool fRc = ASMAtomicCmpXchgPtr(&g_pLogger, pRet, NULL); 471 if (!fRc) 472 { 473 RTLogDestroy(pRet); 474 pRet = g_pLogger; 475 } 467 PRTLOGGER pRet = NULL; 468 469 /* 470 * It's soo easy to end up in a infinite recursion here when enabling 'all' 471 * the logging groups. So, only allow one thread to instantiate the default 472 * logger, muting other attempts at logging while it's being created. 473 */ 474 static volatile bool s_fCreating = false; 475 if (ASMAtomicCmpXchgBool(&s_fCreating, true, false)) 476 { 477 pRet = RTLogDefaultInit(); 478 if (pRet) 479 { 480 bool fRc = ASMAtomicCmpXchgPtr(&g_pLogger, pRet, NULL); 481 if (!fRc) 482 { 483 RTLogDestroy(pRet); 484 pRet = g_pLogger; 485 } 486 } 487 ASMAtomicWriteBool(&s_fCreating, true); 476 488 } 477 489 return pRet;
Note:
See TracChangeset
for help on using the changeset viewer.