Added GetIThread method
git-svn-id: svn://10.0.0.236/trunk@26456 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
ce4669492c
commit
89cf6d5006
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user