зеркало из https://github.com/mozilla/pjs.git
Added GetIThread method
This commit is contained in:
Родитель
1797ffc3c9
Коммит
47085e4f4f
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче