moved GetPrimordialThread from nsAppShellService to nsThread, as suggested by warren

This commit is contained in:
danm@netscape.com
1999-06-13 03:30:38 +00:00
parent 6f159aa380
commit 68c63c0deb
6 changed files with 46 additions and 22 deletions

View File

@@ -21,6 +21,7 @@
//#include <stdio.h>
PRUintn nsThread::kIThreadSelfIndex = 0;
static nsIThread *gMainThread = 0;
////////////////////////////////////////////////////////////////////////////////
@@ -238,6 +239,28 @@ nsIThread::GetIThread(PRThread* prthread, nsIThread* *result)
return NS_OK;
}
NS_COM nsresult
nsIThread::SetMainThread()
{
// strictly speaking, it could be set twice. but practically speaking,
// it's almost certainly an error if it is
if (gMainThread != 0)
return NS_ERROR_FAILURE;
return GetCurrent(&gMainThread);
}
NS_COM nsresult
nsIThread::GetMainThread(nsIThread **result)
{
if (gMainThread == 0)
return NS_ERROR_FAILURE;
if (*result == 0)
return NS_ERROR_NULL_POINTER;
*result = gMainThread;
NS_ADDREF(gMainThread);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
nsThreadPool::nsThreadPool(PRUint32 minThreads, PRUint32 maxThreads)