Changeset 54358 in vbox for trunk/src/VBox/Runtime/common/misc
- Timestamp:
- Feb 22, 2015 11:29:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/thread.cpp
r52457 r54358 74 74 *******************************************************************************/ 75 75 /** The AVL thread containing the threads. */ 76 static PAVLPVNODECORE g_ThreadTree; 76 static PAVLPVNODECORE g_ThreadTree; 77 /** The number of threads in the tree (for ring-0 termination kludge). */ 78 static uint32_t volatile g_cThreadInTree; 77 79 #ifdef IN_RING3 78 80 /** The RW lock protecting the tree. */ … … 455 457 fRc = RTAvlPVInsert(&g_ThreadTree, &pThread->Core); 456 458 ASMAtomicOrU32(&pThread->fIntFlags, RTTHREADINT_FLAG_IN_TREE); 459 if (fRc) 460 ASMAtomicIncU32(&g_cThreadInTree); 457 461 458 462 AssertReleaseMsg(fRc, ("Lock problem? %p (%RTnthrd) %s\n", pThread, NativeThread, pThread->szName)); … … 479 483 pThread, pThread->Core.Key, pThread->szName)); 480 484 #endif 481 NOREF(pThread2); 485 if (pThread2) 486 ASMAtomicDecU32(&g_cThreadInTree); 482 487 } 483 488 … … 1176 1181 */ 1177 1182 if (ASMAtomicBitTestAndClear(&pThread->fFlags, RTTHREADFLAGS_WAITABLE_BIT)) 1183 { 1178 1184 rtThreadRelease(pThread); 1185 #ifdef IN_RING0 1186 /* 1187 * IPRT termination kludge. Call native code to make sure 1188 * the last thread is really out of IPRT to prevent it from 1189 * crashing after we destroyed the spinlock in rtThreadTerm. 1190 */ 1191 if ( ASMAtomicReadU32(&g_cThreadInTree) == 1 1192 && ASMAtomicReadU32(&pThread->cRefs) > 1) 1193 rtThreadNativeWaitKludge(pThread); 1194 #endif 1195 } 1179 1196 } 1180 1197 }
Note:
See TracChangeset
for help on using the changeset viewer.