- Timestamp:
- Nov 8, 2023 5:34:06 PM (18 months ago)
- svn:sync-xref-src-repo-rev:
- 160088
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/threads/nsThread.cpp
r101982 r101991 38 38 #include "nsThread.h" 39 39 #include "prmem.h" 40 #include "prlog.h"41 40 #include "nsAutoLock.h" 42 41 43 42 #include <iprt/assert.h> 43 #include <VBox/log.h> 44 44 45 45 RTTLS nsThread::kIThreadSelfIndex = NIL_RTTLS; 46 46 static nsIThread *gMainThread = 0; 47 47 48 #if defined(PR_LOGGING)49 //50 // Log module for nsIThread logging...51 //52 // To enable logging (see prlog.h for full details):53 //54 // set NSPR_LOG_MODULES=nsIThread:555 // set NSPR_LOG_FILE=nspr.log56 //57 // this enables PR_LOG_DEBUG level information and places all output in58 // the file nspr.log59 //60 // gSocketLog is defined in nsSocketTransport.cpp61 //62 PRLogModuleInfo* nsIThreadLog = nsnull;63 64 #endif /* PR_LOGGING */65 66 48 //////////////////////////////////////////////////////////////////////////////// 67 49 … … 69 51 : mThread(nsnull), mDead(PR_FALSE), mStartLock(nsnull) 70 52 { 71 #if defined(PR_LOGGING)72 //73 // Initialize the global PRLogModule for nsIThread logging74 // if necessary...75 //76 if (nsIThreadLog == nsnull) {77 nsIThreadLog = PR_NewLogModule("nsIThread");78 }79 #endif /* PR_LOGGING */80 81 53 // enforce matching of constants to enums in prthread.h 82 54 NS_ASSERTION(int(nsIThread::PRIORITY_LOW) == int(PR_PRIORITY_LOW) && … … 96 68 PR_DestroyLock(mStartLock); 97 69 98 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 99 ("nsIThread %p destroyed\n", this)); 70 Log(("nsIThread %p destroyed\n", this)); 100 71 101 72 // This code used to free the nsIThreadLog loginfo stuff … … 116 87 NS_ASSERTION(rv == NS_OK, "failed to set thread self"); 117 88 118 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 119 ("nsIThread %p start run %p\n", self, self->mRunnable.get())); 89 Log(("nsIThread %p start run %p\n", self, self->mRunnable.get())); 120 90 rv = self->mRunnable->Run(); 121 91 NS_ASSERTION(NS_SUCCEEDED(rv), "runnable failed"); 122 92 123 #ifdef DEBUG93 #ifdef LOG_ENABLED 124 94 // Because a thread can die after gMainThread dies and takes nsIThreadLog with it, 125 95 // we need to check for it being null so that we don't crash on shutdown. 126 if (nsIThreadLog) { 127 PRThreadState state; 128 rv = self->GetState(&state); 129 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 130 ("nsIThread %p end run %p\n", self, self->mRunnable.get())); 131 } 96 PRThreadState state; 97 rv = self->GetState(&state); 98 Log(("nsIThread %p end run %p\n", self, self->mRunnable.get())); 132 99 #endif 133 100 … … 149 116 self->mDead = PR_TRUE; 150 117 151 #if defined(PR_LOGGING) 152 if (nsIThreadLog) { 153 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 154 ("nsIThread %p exited\n", self)); 155 } 156 #endif 118 Log(("nsIThread %p exited\n", self)); 157 119 NS_RELEASE(self); 158 120 } … … 176 138 // thread-local storage) before they let us join with the thread 177 139 178 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 179 ("nsIThread %p start join\n", this)); 140 Log(("nsIThread %p start join\n", this)); 180 141 if (!mThread) 181 142 return NS_ERROR_NOT_INITIALIZED; … … 183 144 // XXX can't use NS_RELEASE here because the macro wants to set 184 145 // this to null (bad c++) 185 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 186 ("nsIThread %p end join\n", this)); 146 Log(("nsIThread %p end join\n", this)); 187 147 if (status == PR_SUCCESS) { 188 148 NS_RELEASE_THIS(); // most likely the final release of this thread … … 279 239 priority, scope, state, stackSize); 280 240 PR_Unlock(mStartLock); 281 PR_LOG(nsIThreadLog, PR_LOG_DEBUG, 282 ("nsIThread %p created\n", this)); 241 Log(("nsIThread %p created\n", this)); 283 242 284 243 if (mThread == nsnull)
Note:
See TracChangeset
for help on using the changeset viewer.