Make NS_IsMainThread faster on our major platforms. (Bug 521750) r=dbaron

This commit is contained in:
Benjamin Smedberg
2009-10-28 10:28:57 -07:00
parent cf6adad881
commit 1823ed419e
5 changed files with 57 additions and 11 deletions

View File

@@ -38,11 +38,16 @@
#include "nsThreadManager.h"
#include "nsThread.h"
#include "nsThreadUtils.h"
#include "nsIClassInfoImpl.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "nsAutoLock.h"
#ifdef NS_TLS
NS_TLS bool gTLSIsMainThread = false;
#endif
typedef nsTArray< nsRefPtr<nsThread> > nsThreadArray;
//-----------------------------------------------------------------------------
@@ -101,6 +106,10 @@ nsThreadManager::Init()
// GetIsMainThread calls that occur post-Shutdown.
mMainThread->GetPRThread(&mMainPRThread);
#ifdef NS_TLS
gTLSIsMainThread = true;
#endif
mInitialized = PR_TRUE;
return NS_OK;
}