added CreateFromIThread. r:valeski@netscape.com

git-svn-id: svn://10.0.0.236/trunk@51156 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
danm%netscape.com
1999-10-19 19:18:27 +00:00
parent 36419b7094
commit 88e77696a0
3 changed files with 30 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
#include "prmon.h"
#include "nsComponentManager.h"
#include "nsIEventQueue.h"
#include "nsIThread.h"
#include "nsPIEventQueueChain.h"
static NS_DEFINE_CID(kEventQueueCID, NS_EVENTQUEUE_CID);
@@ -208,9 +209,31 @@ NS_IMPL_ISUPPORTS1(nsEventQueueServiceImpl,nsIEventQueueService)
NS_IMETHODIMP
nsEventQueueServiceImpl::CreateThreadEventQueue(void)
{
return CreateEventQueue(PR_GetCurrentThread());
}
NS_IMETHODIMP
nsEventQueueServiceImpl::CreateFromIThread(
nsIThread *aThread, nsIEventQueue **aResult)
{
nsresult rv;
PRThread *prThread;
rv = aThread->GetPRThread(&prThread);
if (NS_SUCCEEDED(rv)) {
rv = CreateEventQueue(prThread); // addrefs
if (NS_SUCCEEDED(rv))
rv = GetThreadEventQueue(prThread, aResult); // doesn't addref
}
return rv;
}
NS_IMETHODIMP
nsEventQueueServiceImpl::CreateEventQueue(PRThread *aThread)
{
nsresult rv = NS_OK;
ThreadKey key(PR_GetCurrentThread());
ThreadKey key(aThread);
EventQueueEntry* evQueueEntry;
/* Enter the lock which protects the EventQ hashtable... */