Bug 1607739 - Retake thread locks at a consistent point, r=jlast.

Differential Revision: https://phabricator.services.mozilla.com/D59105

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Hackett 2020-01-08 15:52:31 +00:00
Родитель 3d665908f0
Коммит 0de8ff99bc
3 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -183,6 +183,7 @@ bool ForkProcess() {
ResetPid();
Thread::RespawnAllThreadsAfterFork();
Thread::OperateOnIdleThreadLocks(Thread::OwnedLockState::NeedAcquire);
Thread::ResumeIdleThreads();
return false;
}

Просмотреть файл

@ -158,7 +158,6 @@ void Thread::ThreadMain(void* aArgument) {
if (forked) {
AutoPassThroughThreadEvents pt;
thread->ReleaseOrAcquireOwnedLocks(OwnedLockState::NeedAcquire);
RestoreThreadStack(thread->Id());
}
@ -554,7 +553,7 @@ void Thread::Wait() {
thread->SetPassThrough(true);
int stackSeparator = 0;
if (!SaveThreadState(thread->Id(), &stackSeparator)) {
// We just installed a stack, notify the main thread since it is waiting
// We just restored the stack, notify the main thread since it is waiting
// for all threads to restore their stacks.
Notify(MainThreadId);
}

Просмотреть файл

@ -13,10 +13,13 @@
namespace mozilla {
namespace recordreplay {
// aStackSeparator is a pointer into the stack. Values shallower than this in
// the stack will be preserved as they are at the time of the SaveThreadState
// call, whereas deeper values will be preserved as they are at the point where
// the main thread saves the remainder of the stack.
// Save the current thread's registers and the top of the stack, such that the
// state can be restored later. Returns true if the state was just saved, and
// false if the state was just restored. aStackSeparator is a pointer into the
// stack. Values shallower than this in the stack will be preserved as they are
// at the time of the SaveThreadState call, whereas deeper values will be
// preserved as they are at the point where the main thread saves the remainder
// of the stack.
bool SaveThreadState(size_t aId, int* aStackSeparator);
// Remember the entire stack contents for a thread, after forking.