From 800cde85660d65cf6486776877cb8500073a0686 Mon Sep 17 00:00:00 2001 From: "timeless%mac.com" Date: Tue, 3 Sep 2002 14:51:05 +0000 Subject: [PATCH] Bug 156633 replace PR_CurrentThread with PR_GetCurrentThread patch by riceman+bmo@mail.rit.edu r=morse,dougt,dveditz,timeless sr=dveditz git-svn-id: svn://10.0.0.236/trunk@128704 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/wallet/src/singsign.cpp | 4 ++-- .../mac/MacMemoryAllocator/src/MemoryTracker.c | 4 ++-- .../lib/mac/MacMemoryAllocator/src/StdCLevel.c | 4 ++-- mozilla/modules/libjar/nsJARChannel.cpp | 14 +++++++------- .../plugin/samples/SanePlugin/nsSanePlugin.cpp | 4 ++-- .../netwerk/protocol/file/src/nsFileChannel.cpp | 16 ++++++++-------- .../netwerk/protocol/jar/src/nsJARChannel.cpp | 14 +++++++------- mozilla/netwerk/test/TestCacheMgr.cpp | 2 +- mozilla/netwerk/test/TestRawCache.cpp | 2 +- mozilla/webshell/tests/viewer/nsPhMain.cpp | 2 +- .../webshell/tests/viewer/unix/gtk/nsGtkMain.cpp | 2 +- .../tests/viewer/unix/gtk2/nsGtkMain.cpp | 2 +- mozilla/xpcom/glue/nsDebug.cpp | 4 ++-- mozilla/xpcom/threads/nsThread.cpp | 8 ++++---- mozilla/xpcom/threads/plevent.c | 4 ++-- mozilla/xpfe/bootstrap/nsSigHandlers.cpp | 4 ++-- 16 files changed, 45 insertions(+), 45 deletions(-) diff --git a/mozilla/extensions/wallet/src/singsign.cpp b/mozilla/extensions/wallet/src/singsign.cpp index 28801d656b6..23cea4e0569 100644 --- a/mozilla/extensions/wallet/src/singsign.cpp +++ b/mozilla/extensions/wallet/src/singsign.cpp @@ -120,7 +120,7 @@ si_lock_signon_list(void) { while(PR_TRUE) { /* no current owner or owned by this thread */ - PRThread * t = PR_CurrentThread(); + PRThread * t = PR_GetCurrentThread(); if(signon_lock_owner == NULL || signon_lock_owner == t) { signon_lock_owner = t; signon_lock_count++; @@ -139,7 +139,7 @@ si_unlock_signon_list(void) { #ifdef DEBUG /* make sure someone doesn't try to free a lock they don't own */ - PR_ASSERT(signon_lock_owner == PR_CurrentThread()); + PR_ASSERT(signon_lock_owner == PR_GetCurrentThread()); #endif signon_lock_count--; diff --git a/mozilla/lib/mac/MacMemoryAllocator/src/MemoryTracker.c b/mozilla/lib/mac/MacMemoryAllocator/src/MemoryTracker.c index 6a2ac514b3b..07ba4abd0c5 100644 --- a/mozilla/lib/mac/MacMemoryAllocator/src/MemoryTracker.c +++ b/mozilla/lib/mac/MacMemoryAllocator/src/MemoryTracker.c @@ -1259,7 +1259,7 @@ void GetCurrentStackTrace(void **stackCrawl) return; #endif - curThread = PR_CurrentThread(); + curThread = PR_GetCurrentThread(); if ( curThread != NULL && curThread->stack->stackBottom != 0 ) { stackMin = curThread->stack->stackBottom; @@ -1383,7 +1383,7 @@ void GetCurrentNativeStackTrace ( void ** stackCrawl ) return; #endif - curThread = PR_CurrentThread(); + curThread = PR_GetCurrentThread(); if ( curThread != NULL && curThread->stack->stackBottom != 0 ) { stackMin = curThread->stack->stackBottom; diff --git a/mozilla/lib/mac/MacMemoryAllocator/src/StdCLevel.c b/mozilla/lib/mac/MacMemoryAllocator/src/StdCLevel.c index 99ede6dd6bf..326c58624eb 100644 --- a/mozilla/lib/mac/MacMemoryAllocator/src/StdCLevel.c +++ b/mozilla/lib/mac/MacMemoryAllocator/src/StdCLevel.c @@ -2877,7 +2877,7 @@ void GetCurrentStackTrace(void **stackCrawl) return; #endif - curThread = PR_CurrentThread(); + curThread = PR_GetCurrentThread(); if ( curThread != NULL && curThread->stack->stackBottom != 0 ) { stackMin = curThread->stack->stackBottom; @@ -3004,7 +3004,7 @@ void GetCurrentNativeStackTrace ( void ** stackCrawl ) return; #endif - curThread = PR_CurrentThread(); + curThread = PR_GetCurrentThread(); if ( curThread != NULL && curThread->stack->stackBottom != 0 ) { stackMin = curThread->stack->stackBottom; diff --git a/mozilla/modules/libjar/nsJARChannel.cpp b/mozilla/modules/libjar/nsJARChannel.cpp index 3e843fc80c9..f67601a2acf 100644 --- a/mozilla/modules/libjar/nsJARChannel.cpp +++ b/mozilla/modules/libjar/nsJARChannel.cpp @@ -153,7 +153,7 @@ NS_IMETHODIMP nsJARChannel::Cancel(nsresult status) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code"); nsresult rv = NS_OK; @@ -171,7 +171,7 @@ NS_IMETHODIMP nsJARChannel::Suspend() { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif nsresult rv = NS_OK; @@ -186,7 +186,7 @@ NS_IMETHODIMP nsJARChannel::Resume() { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif nsresult rv = NS_OK; @@ -264,7 +264,7 @@ nsJARChannel::AsyncOpen(nsIStreamListener* listener, nsISupports* ctxt) nsresult rv; #ifdef DEBUG - mInitiator = PR_CurrentThread(); + mInitiator = PR_GetCurrentThread(); #endif mUserContext = ctxt; @@ -577,7 +577,7 @@ nsJARChannel::OnStartRequest(nsIRequest* jarExtractionTransport, nsISupports* context) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif return mUserListener->OnStartRequest(this, mUserContext); } @@ -588,7 +588,7 @@ nsJARChannel::OnStopRequest(nsIRequest* jarExtractionTransport, nsISupports* con { nsresult rv; #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif #ifdef PR_LOGGING if (PR_LOG_TEST(gJarProtocolLog, PR_LOG_DEBUG)) { @@ -626,7 +626,7 @@ nsJARChannel::OnDataAvailable(nsIRequest* jarCacheTransport, PRUint32 count) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif return mUserListener->OnDataAvailable(this, mUserContext, inStr, sourceOffset, count); diff --git a/mozilla/modules/plugin/samples/SanePlugin/nsSanePlugin.cpp b/mozilla/modules/plugin/samples/SanePlugin/nsSanePlugin.cpp index 6e146cfe7f0..e425d59a21c 100644 --- a/mozilla/modules/plugin/samples/SanePlugin/nsSanePlugin.cpp +++ b/mozilla/modules/plugin/samples/SanePlugin/nsSanePlugin.cpp @@ -109,7 +109,7 @@ nsSanePluginInstance::nsSanePluginInstance( void ) mOnScanCompleteScript = nsnull; mOnInitCompleteScript = nsnull; mScanThread = nsnull; - mUIThread = PR_CurrentThread(); + mUIThread = PR_GetCurrentThread(); mState = 0; // idle mSuccess = 1; // success @@ -682,7 +682,7 @@ nsSanePluginInstance::IsUIThread() if (!mUIThread) return PR_FALSE; - return (mUIThread == PR_CurrentThread()); + return (mUIThread == PR_GetCurrentThread()); } // End of Plugin Instance API Methods. diff --git a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp index 3ffbd71881b..ba9f82dae93 100644 --- a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp +++ b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp @@ -193,7 +193,7 @@ nsFileChannel::Cancel(nsresult status) { NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code"); #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); #endif mStatus = status; @@ -206,7 +206,7 @@ NS_IMETHODIMP nsFileChannel::Suspend() { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); #endif if (mCurrentRequest) @@ -218,7 +218,7 @@ NS_IMETHODIMP nsFileChannel::Resume() { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); #endif if (mCurrentRequest) @@ -323,9 +323,9 @@ nsFileChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) nsresult rv; #ifdef DEBUG - NS_ASSERTION(mInitiator == nsnull || mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == nsnull || mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); - mInitiator = PR_CurrentThread(); + mInitiator = PR_GetCurrentThread(); #endif if (mFileTransport) @@ -522,7 +522,7 @@ nsFileChannel::OnStartRequest(nsIRequest* request, nsISupports* context) // unconditionally inherit the status of the file transport request->GetStatus(&mStatus); #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); #endif NS_ASSERTION(mRealListener, "No listener..."); @@ -554,7 +554,7 @@ nsFileChannel::OnStopRequest(nsIRequest* request, nsISupports* context, mStatus = aStatus; #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); #endif @@ -583,7 +583,7 @@ nsFileChannel::OnDataAvailable(nsIRequest* request, nsISupports* context, PRUint32 aLength) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread calling this routine"); #endif diff --git a/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp b/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp index 3e843fc80c9..f67601a2acf 100644 --- a/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp +++ b/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp @@ -153,7 +153,7 @@ NS_IMETHODIMP nsJARChannel::Cancel(nsresult status) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code"); nsresult rv = NS_OK; @@ -171,7 +171,7 @@ NS_IMETHODIMP nsJARChannel::Suspend() { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif nsresult rv = NS_OK; @@ -186,7 +186,7 @@ NS_IMETHODIMP nsJARChannel::Resume() { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif nsresult rv = NS_OK; @@ -264,7 +264,7 @@ nsJARChannel::AsyncOpen(nsIStreamListener* listener, nsISupports* ctxt) nsresult rv; #ifdef DEBUG - mInitiator = PR_CurrentThread(); + mInitiator = PR_GetCurrentThread(); #endif mUserContext = ctxt; @@ -577,7 +577,7 @@ nsJARChannel::OnStartRequest(nsIRequest* jarExtractionTransport, nsISupports* context) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif return mUserListener->OnStartRequest(this, mUserContext); } @@ -588,7 +588,7 @@ nsJARChannel::OnStopRequest(nsIRequest* jarExtractionTransport, nsISupports* con { nsresult rv; #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif #ifdef PR_LOGGING if (PR_LOG_TEST(gJarProtocolLog, PR_LOG_DEBUG)) { @@ -626,7 +626,7 @@ nsJARChannel::OnDataAvailable(nsIRequest* jarCacheTransport, PRUint32 count) { #ifdef DEBUG - NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread"); + NS_ASSERTION(mInitiator == PR_GetCurrentThread(), "wrong thread"); #endif return mUserListener->OnDataAvailable(this, mUserContext, inStr, sourceOffset, count); diff --git a/mozilla/netwerk/test/TestCacheMgr.cpp b/mozilla/netwerk/test/TestCacheMgr.cpp index 0df52d9b8ee..dc5490144e8 100644 --- a/mozilla/netwerk/test/TestCacheMgr.cpp +++ b/mozilla/netwerk/test/TestCacheMgr.cpp @@ -260,7 +260,7 @@ InitQueue() { do_GetService(kEventQueueServiceCID, &rv); NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't get event queue service"); - rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQueue); + rv = eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &eventQueue); NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't get event queue for main thread"); return NS_OK; diff --git a/mozilla/netwerk/test/TestRawCache.cpp b/mozilla/netwerk/test/TestRawCache.cpp index dd37d009992..087f7885e79 100644 --- a/mozilla/netwerk/test/TestRawCache.cpp +++ b/mozilla/netwerk/test/TestRawCache.cpp @@ -268,7 +268,7 @@ InitQueue() { do_GetService(kEventQueueServiceCID, &rv); NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't get event queue service"); - rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQueue); + rv = eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &eventQueue); NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't get event queue for main thread"); return NS_OK; diff --git a/mozilla/webshell/tests/viewer/nsPhMain.cpp b/mozilla/webshell/tests/viewer/nsPhMain.cpp index d7546873f5d..2379e09f3c9 100644 --- a/mozilla/webshell/tests/viewer/nsPhMain.cpp +++ b/mozilla/webshell/tests/viewer/nsPhMain.cpp @@ -151,7 +151,7 @@ void abnormal_exit_handler(int signum) || (signum == SIGABRT) ) { - PR_CurrentThread(); + PR_GetCurrentThread(); printf("prog = viewer\npid = %d\nsignal = %s\n", getpid(), strsignal(signum)); #if 0 diff --git a/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp b/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp index 046ed0264ad..19473251bb6 100644 --- a/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp +++ b/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp @@ -146,7 +146,7 @@ static char _progname[1024] = "huh?"; void ah_crap_handler(int signum) { - PR_CurrentThread(); + PR_GetCurrentThread(); printf("prog = %s\npid = %d\nsignal = %s\n", _progname, diff --git a/mozilla/webshell/tests/viewer/unix/gtk2/nsGtkMain.cpp b/mozilla/webshell/tests/viewer/unix/gtk2/nsGtkMain.cpp index c23b9ca76eb..3d902c35b81 100644 --- a/mozilla/webshell/tests/viewer/unix/gtk2/nsGtkMain.cpp +++ b/mozilla/webshell/tests/viewer/unix/gtk2/nsGtkMain.cpp @@ -144,7 +144,7 @@ static char _progname[1024] = "huh?"; void ah_crap_handler(int signum) { - PR_CurrentThread(); + PR_GetCurrentThread(); printf("prog = %s\npid = %d\nsignal = %s\n", _progname, diff --git a/mozilla/xpcom/glue/nsDebug.cpp b/mozilla/xpcom/glue/nsDebug.cpp index fae14c59cff..746d5ee8fbc 100644 --- a/mozilla/xpcom/glue/nsDebug.cpp +++ b/mozilla/xpcom/glue/nsDebug.cpp @@ -489,7 +489,7 @@ NS_ErrorAccordingToNSPR() } //////////////////////////////////////////////////////////////////////////////// -// This wrapper around PR_CurrentThread is simply here for debug builds so +// This wrapper around PR_GetCurrentThread is simply here for debug builds so // that clients linking with xpcom don't also have to link with nspr explicitly. #if defined(NS_DEBUG) && defined(NS_MT_SUPPORTED) @@ -503,7 +503,7 @@ extern "C" NS_COM void NS_CheckThreadSafe(void* owningThread, const char* msg); void* NS_CurrentThread(void) { - void* th = PR_CurrentThread(); + void* th = PR_GetCurrentThread(); return th; } diff --git a/mozilla/xpcom/threads/nsThread.cpp b/mozilla/xpcom/threads/nsThread.cpp index 0c7b977047b..50b6c54cf90 100644 --- a/mozilla/xpcom/threads/nsThread.cpp +++ b/mozilla/xpcom/threads/nsThread.cpp @@ -275,14 +275,14 @@ nsThread::Init(nsIRunnable* runnable, NS_IMETHODIMP nsThread::GetCurrentThread(nsIThread * *aCurrentThread) { - return GetIThread(PR_CurrentThread(), aCurrentThread); + return GetIThread(PR_GetCurrentThread(), aCurrentThread); } /* void sleep (in PRUint32 msec); */ NS_IMETHODIMP nsThread::Sleep(PRUint32 msec) { - if (PR_CurrentThread() != mThread) + if (PR_GetCurrentThread() != mThread) return NS_ERROR_FAILURE; if (PR_Sleep(PR_MillisecondsToInterval(msec)) != PR_SUCCESS) @@ -361,7 +361,7 @@ nsThread::WaitUntilReadyToStartMain() NS_COM nsresult nsIThread::GetCurrent(nsIThread* *result) { - return GetIThread(PR_CurrentThread(), result); + return GetIThread(PR_GetCurrentThread(), result); } NS_COM nsresult @@ -424,7 +424,7 @@ nsIThread::IsMainThread() PRThread *theMainThread; gMainThread->GetPRThread(&theMainThread); - return theMainThread == PR_CurrentThread(); + return theMainThread == PR_GetCurrentThread(); } void diff --git a/mozilla/xpcom/threads/plevent.c b/mozilla/xpcom/threads/plevent.c index 6f0e4153297..0920c05e5d0 100644 --- a/mozilla/xpcom/threads/plevent.c +++ b/mozilla/xpcom/threads/plevent.c @@ -346,7 +346,7 @@ PL_PostSynchronousEvent(PLEventQueue* self, PLEvent* event) PR_ASSERT(event != NULL); PR_Lock(event->lock); - if (PR_CurrentThread() == self->handlerThread) { + if (PR_GetCurrentThread() == self->handlerThread) { /* Handle the case where the thread requesting the event handling is also the thread that's supposed to do the handling. */ result = event->handler(event); @@ -693,7 +693,7 @@ PL_DequeueEvent(PLEvent* self, PLEventQueue* queue) client has put it in the queue, they have no idea whether it's been processed and destroyed or not. */ - PR_ASSERT(queue->handlerThread == PR_CurrentThread()); + PR_ASSERT(queue->handlerThread == PR_GetCurrentThread()); PR_EnterMonitor(queue->monitor); diff --git a/mozilla/xpfe/bootstrap/nsSigHandlers.cpp b/mozilla/xpfe/bootstrap/nsSigHandlers.cpp index 64813b559b6..800cbdabe21 100644 --- a/mozilla/xpfe/bootstrap/nsSigHandlers.cpp +++ b/mozilla/xpfe/bootstrap/nsSigHandlers.cpp @@ -94,7 +94,7 @@ void abnormal_exit_handler(int signum) || (signum == SIGABRT) ) { - PR_CurrentThread(); + PR_GetCurrentThread(); printf("prog = %s\npid = %d\nsignal = %s\n", _progname, getpid(), strsignal(signum)); @@ -118,7 +118,7 @@ void abnormal_exit_handler(int signum) void ah_crap_handler(int signum) { - PR_CurrentThread(); + PR_GetCurrentThread(); // I don't think strsignal is portable. If it is, this can be changed. #ifdef LINUX