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
lldb
|
@ -3433,12 +3433,15 @@ protected:
|
|||
void
|
||||
ResumePrivateStateThread ();
|
||||
|
||||
private:
|
||||
struct PrivateStateThreadArgs
|
||||
{
|
||||
PrivateStateThreadArgs(Process *p, bool s) : process(p), is_secondary_thread(s) {};
|
||||
Process *process;
|
||||
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
|
||||
PrivateStateThread (void *arg);
|
||||
|
||||
|
@ -3450,6 +3453,7 @@ protected:
|
|||
lldb::thread_result_t
|
||||
RunPrivateStateThread (bool is_secondary_thread);
|
||||
|
||||
protected:
|
||||
void
|
||||
HandlePrivateEvent (lldb::EventSP &event_sp);
|
||||
|
||||
|
|
|
@ -4065,8 +4065,8 @@ Process::StartPrivateStateThread (bool is_secondary_thread)
|
|||
}
|
||||
|
||||
// Create the private state thread, and start it running.
|
||||
PrivateStateThreadArgs args = {this, is_secondary_thread};
|
||||
m_private_state_thread = ThreadLauncher::LaunchThread(thread_name, Process::PrivateStateThread, (void *) &args, NULL, 8 * 1024 * 1024);
|
||||
PrivateStateThreadArgs *args_ptr = new PrivateStateThreadArgs(this, is_secondary_thread);
|
||||
m_private_state_thread = ThreadLauncher::LaunchThread(thread_name, Process::PrivateStateThread, (void *) args_ptr, NULL, 8 * 1024 * 1024);
|
||||
if (m_private_state_thread.IsJoinable())
|
||||
{
|
||||
ResumePrivateStateThread();
|
||||
|
@ -4308,8 +4308,9 @@ Process::HaltPrivate()
|
|||
thread_result_t
|
||||
Process::PrivateStateThread (void *arg)
|
||||
{
|
||||
PrivateStateThreadArgs *real_args = static_cast<PrivateStateThreadArgs *> (arg);
|
||||
thread_result_t result = real_args->process->RunPrivateStateThread(real_args->is_secondary_thread);
|
||||
PrivateStateThreadArgs real_args = *static_cast<PrivateStateThreadArgs *> (arg);
|
||||
free (arg);
|
||||
thread_result_t result = real_args.process->RunPrivateStateThread(real_args.is_secondary_thread);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue