NS_ADDREF(thread);
NS_NewThread(nsIThread* *result,              nsIRunnable* runnable,             PRUint32 stackSize,             PRThreadPriority priority,             PRThreadScope scope,             PRThreadState state){    nsresult rv;    nsThread* thread = new nsThread();    if (thread == nsnull)        return NS_ERROR_OUT_OF_MEMORY;    rv = thread->Init(runnable, stackSize, priority, scope, state);    if (NS_FAILED(rv)) {        delete thread;        return rv;    }    NS_ADDREF(thread);    *result = thread;    return NS_OK;}