зеркало из https://github.com/mozilla/gecko-dev.git
Bug 875125 - Construct worker thread's PerThreadData before spawning actual thread on a CLOSED TREE
This commit is contained in:
Родитель
37ae6b1cab
Коммит
e1cc087ce3
|
@ -311,6 +311,8 @@ WorkerThreadState::init(JSRuntime *rt)
|
||||||
for (size_t i = 0; i < numThreads; i++) {
|
for (size_t i = 0; i < numThreads; i++) {
|
||||||
WorkerThread &helper = threads[i];
|
WorkerThread &helper = threads[i];
|
||||||
helper.runtime = rt;
|
helper.runtime = rt;
|
||||||
|
helper.threadData.construct(rt);
|
||||||
|
helper.threadData.ref().addToThreadList();
|
||||||
helper.thread = PR_CreateThread(PR_USER_THREAD,
|
helper.thread = PR_CreateThread(PR_USER_THREAD,
|
||||||
WorkerThread::ThreadMain, &helper,
|
WorkerThread::ThreadMain, &helper,
|
||||||
PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
|
PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
|
||||||
|
@ -322,8 +324,6 @@ WorkerThreadState::init(JSRuntime *rt)
|
||||||
numThreads = 0;
|
numThreads = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
helper.threadData.construct(rt);
|
|
||||||
helper.threadData.ref().addToThreadList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAsmJSFailureState();
|
resetAsmJSFailureState();
|
||||||
|
@ -439,19 +439,20 @@ WorkerThread::destroy()
|
||||||
{
|
{
|
||||||
WorkerThreadState &state = *runtime->workerThreadState;
|
WorkerThreadState &state = *runtime->workerThreadState;
|
||||||
|
|
||||||
if (!thread)
|
if (thread) {
|
||||||
return;
|
{
|
||||||
|
AutoLockWorkerThreadState lock(runtime);
|
||||||
|
terminate = true;
|
||||||
|
|
||||||
{
|
/* Notify all workers, to ensure that this thread wakes up. */
|
||||||
AutoLockWorkerThreadState lock(runtime);
|
state.notifyAll(WorkerThreadState::WORKER);
|
||||||
terminate = true;
|
}
|
||||||
|
|
||||||
/* Notify all workers, to ensure that this thread wakes up. */
|
PR_JoinThread(thread);
|
||||||
state.notifyAll(WorkerThreadState::WORKER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PR_JoinThread(thread);
|
if (!threadData.empty())
|
||||||
threadData.ref().removeFromThreadList();
|
threadData.ref().removeFromThreadList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче