This commit is contained in:
warren%netscape.com 1999-04-06 06:09:15 +00:00
Родитель 1797ffc3c9
Коммит 47085e4f4f
4 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@ -59,8 +59,12 @@ class nsIThread : public nsISupports
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITHREAD_IID);
// returns the nsIThread for the current thread:
static NS_BASE nsresult GetCurrent(nsIThread* *result);
// returns the nsIThread for an arbitrary PRThread:
static NS_BASE nsresult GetIThread(PRThread* prthread, nsIThread* *result);
NS_IMETHOD Join() = 0;
NS_IMETHOD GetPriority(PRThreadPriority *result) = 0;

Просмотреть файл

@ -201,6 +201,12 @@ nsThread::RegisterThreadSelf()
NS_BASE nsresult
nsIThread::GetCurrent(nsIThread* *result)
{
return GetIThread(PR_CurrentThread(), result);
}
NS_BASE nsresult
nsIThread::GetIThread(PRThread* prthread, nsIThread* *result)
{
PRStatus status;
nsThread* thread;
@ -219,7 +225,7 @@ nsIThread::GetCurrent(nsIThread* *result)
if (thread == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(thread);
thread->SetPRThread(PR_CurrentThread());
thread->SetPRThread(prthread);
nsresult rv = thread->RegisterThreadSelf();
if (NS_FAILED(rv)) return rv;
}

Просмотреть файл

@ -59,8 +59,12 @@ class nsIThread : public nsISupports
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITHREAD_IID);
// returns the nsIThread for the current thread:
static NS_BASE nsresult GetCurrent(nsIThread* *result);
// returns the nsIThread for an arbitrary PRThread:
static NS_BASE nsresult GetIThread(PRThread* prthread, nsIThread* *result);
NS_IMETHOD Join() = 0;
NS_IMETHOD GetPriority(PRThreadPriority *result) = 0;

Просмотреть файл

@ -201,6 +201,12 @@ nsThread::RegisterThreadSelf()
NS_BASE nsresult
nsIThread::GetCurrent(nsIThread* *result)
{
return GetIThread(PR_CurrentThread(), result);
}
NS_BASE nsresult
nsIThread::GetIThread(PRThread* prthread, nsIThread* *result)
{
PRStatus status;
nsThread* thread;
@ -219,7 +225,7 @@ nsIThread::GetCurrent(nsIThread* *result)
if (thread == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(thread);
thread->SetPRThread(PR_CurrentThread());
thread->SetPRThread(prthread);
nsresult rv = thread->RegisterThreadSelf();
if (NS_FAILED(rv)) return rv;
}