Fixing a problem where CommandObjectThreadContinue held the thread list lock while waiting for the process to stop after a continue.

llvm-svn: 190626
This commit is contained in:
Andrew Kaylor 2013-09-12 19:15:05 +00:00
parent e5416ec2d2
commit 9063bf462a
1 changed files with 18 additions and 9 deletions

View File

@ -660,11 +660,14 @@ public:
StateType state = process->GetState();
if ((state == eStateCrashed) || (state == eStateStopped) || (state == eStateSuspended))
{
Mutex::Locker locker (process->GetThreadList().GetMutex());
const uint32_t num_threads = process->GetThreadList().GetSize();
const size_t argc = command.GetArgumentCount();
if (argc > 0)
{
// These two lines appear at the beginning of both blocks in
// this if..else, but that is because we need to release the
// lock before calling process->Resume below.
Mutex::Locker locker (process->GetThreadList().GetMutex());
const uint32_t num_threads = process->GetThreadList().GetSize();
std::vector<Thread *> resume_threads;
for (uint32_t i=0; i<argc; ++i)
{
@ -732,6 +735,11 @@ public:
}
else
{
// These two lines appear at the beginning of both blocks in
// this if..else, but that is because we need to release the
// lock before calling process->Resume below.
Mutex::Locker locker (process->GetThreadList().GetMutex());
const uint32_t num_threads = process->GetThreadList().GetSize();
Thread *current_thread = process->GetThreadList().GetSelectedThread().get();
if (current_thread == NULL)
{
@ -755,6 +763,7 @@ public:
}
}
// We should not be holding the thread list lock when we do this.
Error error (process->Resume());
if (error.Success())
{