forked from OSchip/llvm-project
Fix a little threading thinko in StartPrivateStateThread - don't pass stack variables
as args to a pthread_create function... <rdar://problem/24485206> llvm-svn: 259738
This commit is contained in:
parent
eb14ac5396
commit
a1ca8148a1
|
@ -3433,12 +3433,15 @@ protected:
|
||||||
void
|
void
|
||||||
ResumePrivateStateThread ();
|
ResumePrivateStateThread ();
|
||||||
|
|
||||||
|
private:
|
||||||
struct PrivateStateThreadArgs
|
struct PrivateStateThreadArgs
|
||||||
{
|
{
|
||||||
|
PrivateStateThreadArgs(Process *p, bool s) : process(p), is_secondary_thread(s) {};
|
||||||
Process *process;
|
Process *process;
|
||||||
bool is_secondary_thread;
|
bool is_secondary_thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// arg is a pointer to a new'ed PrivateStateThreadArgs structure. PrivateStateThread will free it for you.
|
||||||
static lldb::thread_result_t
|
static lldb::thread_result_t
|
||||||
PrivateStateThread (void *arg);
|
PrivateStateThread (void *arg);
|
||||||
|
|
||||||
|
@ -3450,6 +3453,7 @@ protected:
|
||||||
lldb::thread_result_t
|
lldb::thread_result_t
|
||||||
RunPrivateStateThread (bool is_secondary_thread);
|
RunPrivateStateThread (bool is_secondary_thread);
|
||||||
|
|
||||||
|
protected:
|
||||||
void
|
void
|
||||||
HandlePrivateEvent (lldb::EventSP &event_sp);
|
HandlePrivateEvent (lldb::EventSP &event_sp);
|
||||||
|
|
||||||
|
|
|
@ -4065,8 +4065,8 @@ Process::StartPrivateStateThread (bool is_secondary_thread)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the private state thread, and start it running.
|
// Create the private state thread, and start it running.
|
||||||
PrivateStateThreadArgs args = {this, is_secondary_thread};
|
PrivateStateThreadArgs *args_ptr = new PrivateStateThreadArgs(this, is_secondary_thread);
|
||||||
m_private_state_thread = ThreadLauncher::LaunchThread(thread_name, Process::PrivateStateThread, (void *) &args, NULL, 8 * 1024 * 1024);
|
m_private_state_thread = ThreadLauncher::LaunchThread(thread_name, Process::PrivateStateThread, (void *) args_ptr, NULL, 8 * 1024 * 1024);
|
||||||
if (m_private_state_thread.IsJoinable())
|
if (m_private_state_thread.IsJoinable())
|
||||||
{
|
{
|
||||||
ResumePrivateStateThread();
|
ResumePrivateStateThread();
|
||||||
|
@ -4308,8 +4308,9 @@ Process::HaltPrivate()
|
||||||
thread_result_t
|
thread_result_t
|
||||||
Process::PrivateStateThread (void *arg)
|
Process::PrivateStateThread (void *arg)
|
||||||
{
|
{
|
||||||
PrivateStateThreadArgs *real_args = static_cast<PrivateStateThreadArgs *> (arg);
|
PrivateStateThreadArgs real_args = *static_cast<PrivateStateThreadArgs *> (arg);
|
||||||
thread_result_t result = real_args->process->RunPrivateStateThread(real_args->is_secondary_thread);
|
free (arg);
|
||||||
|
thread_result_t result = real_args.process->RunPrivateStateThread(real_args.is_secondary_thread);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue