Changeset 101960 in vbox
- Timestamp:
- Nov 8, 2023 11:04:10 AM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/xpcom/threads
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/threads/nsThread.cpp
r1 r101960 41 41 #include "nsAutoLock.h" 42 42 43 PRUintn nsThread::kIThreadSelfIndex = 0; 43 #include <iprt/assert.h> 44 45 RTTLS nsThread::kIThreadSelfIndex = NIL_RTTLS; 44 46 static nsIThread *gMainThread = 0; 45 47 … … 135 137 } 136 138 137 void 139 DECLCALLBACK(void) 138 140 nsThread::Exit(void* arg) 139 141 { … … 349 351 nsThread::RegisterThreadSelf() 350 352 { 351 PRStatus status;352 353 if (kIThreadSelfIndex == 0) {354 status = PR_NewThreadPrivateIndex(&kIThreadSelfIndex, Exit);355 if ( status != PR_SUCCESS) return NS_ERROR_FAILURE;356 } 357 358 status = PR_SetThreadPrivate(kIThreadSelfIndex, this);359 if ( status != PR_SUCCESS) return NS_ERROR_FAILURE;353 int vrc; 354 355 if (kIThreadSelfIndex == NIL_RTTLS) { 356 vrc = RTTlsAllocEx(&kIThreadSelfIndex, Exit); 357 if (RT_FAILURE(vrc)) return NS_ERROR_FAILURE; 358 } 359 360 vrc = RTTlsSet(kIThreadSelfIndex, this); 361 if (RT_FAILURE(vrc)) return NS_ERROR_FAILURE; 360 362 361 363 return NS_OK; … … 380 382 nsIThread::GetIThread(PRThread* prthread, nsIThread* *result) 381 383 { 382 PRStatus status;383 384 nsThread* thread; 384 385 385 if (nsThread::kIThreadSelfIndex == 0) {386 status = PR_NewThreadPrivateIndex(&nsThread::kIThreadSelfIndex, nsThread::Exit);387 if ( status != PR_SUCCESS) return NS_ERROR_FAILURE;388 } 389 390 thread = (nsThread*) PR_GetThreadPrivate(nsThread::kIThreadSelfIndex);386 if (nsThread::kIThreadSelfIndex == NIL_RTTLS) { 387 int vrc = RTTlsAllocEx(&nsThread::kIThreadSelfIndex, nsThread::Exit); 388 if (RT_FAILURE(vrc)) return NS_ERROR_FAILURE; 389 } 390 391 thread = (nsThread*)RTTlsGet(nsThread::kIThreadSelfIndex); 391 392 if (thread == nsnull) { 392 393 // if the current thread doesn't have an nsIThread associated … … 450 451 NS_WARN_IF_FALSE(cnt == 0, "Main thread being held past XPCOM shutdown."); 451 452 gMainThread = nsnull; 452 453 kIThreadSelfIndex = 0; 453 454 int vrc = RTTlsFree(kIThreadSelfIndex); 455 AssertRC(vrc); RT_NOREF(vrc); 456 kIThreadSelfIndex = NIL_RTTLS; 454 457 } 455 458 } -
trunk/src/libs/xpcom18a4/xpcom/threads/nsThread.h
r1 r101960 54 54 #include "nsCOMPtr.h" 55 55 56 #include <iprt/thread.h> 57 56 58 class nsThread : public nsIThread 57 59 { … … 70 72 71 73 static void PR_CALLBACK Main(void* arg); 72 static void PR_CALLBACKExit(void* arg);74 static DECLCALLBACK(void) Exit(void* arg); 73 75 static void PR_CALLBACK Shutdown(); 74 76 75 static PRUintnkIThreadSelfIndex;77 static RTTLS kIThreadSelfIndex; 76 78 77 79 static NS_METHOD
Note:
See TracChangeset
for help on using the changeset viewer.