Bug 1323100 - Add nsThreadManager::NewNamedThread API. r=froydnj
The point of this exercise is to make the thread name available in the thread func of the thread, so that we can register the thread with the profiler from the very start of its lifetime, and so that registration and unregistration can be inside the same function. MozReview-Commit-ID: DiiMKUQVr55
This commit is contained in:
@@ -248,6 +248,14 @@ NS_IMETHODIMP
|
||||
nsThreadManager::NewThread(uint32_t aCreationFlags,
|
||||
uint32_t aStackSize,
|
||||
nsIThread** aResult)
|
||||
{
|
||||
return NewNamedThread(NS_LITERAL_CSTRING(""), aStackSize, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsThreadManager::NewNamedThread(const nsACString& aName,
|
||||
uint32_t aStackSize,
|
||||
nsIThread** aResult)
|
||||
{
|
||||
// Note: can be called from arbitrary threads
|
||||
|
||||
@@ -257,7 +265,7 @@ nsThreadManager::NewThread(uint32_t aCreationFlags,
|
||||
}
|
||||
|
||||
RefPtr<nsThread> thr = new nsThread(nsThread::NOT_MAIN_THREAD, aStackSize);
|
||||
nsresult rv = thr->Init(); // Note: blocks until the new thread has been set up
|
||||
nsresult rv = thr->Init(aName); // Note: blocks until the new thread has been set up
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user