[Lldb-commits] [PATCH] Don't resume when creating new threads if there is a pending thread stop.
Oleksiy Vyalov
ovyalov at google.com
Wed Apr 8 20:30:23 PDT 2015
================
Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:2135
@@ -2135,8 +2134,3 @@
NotifyThreadCreateStopped (tid);
- m_coordinator_up->RequestThreadResume (tid,
- [=](lldb::tid_t tid_to_resume, bool supress_signal)
- {
- std::static_pointer_cast<NativeThreadLinux> (new_thread_sp)->SetRunning ();
- return Resume (tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER);
- },
- CoordinatorErrorHandler);
+ if (m_coordinator_up->IsPendingThreadStop())
+ {
----------------
It looks to me there might be a race - if you'll be calling this method when TSC inside of ProcessEvent call between RequestStopOnAllRunningThreads() and coordinator.SetPendingNotification() a thread might be mistakenly resumed. So, you may to synchronize IsPendingThreadStop with ProcessEvent().
Can we make RequestThreadResume take additional boolean argument to check for pending stopped state - so, effectively move this conditional logic into EventRequestResume?
================
Comment at: source/Plugins/Process/Linux/ThreadStateCoordinator.h:152
@@ +151,3 @@
+ bool
+ IsPendingThreadStop() {
+ return GetPendingThreadStopNotification();
----------------
This method should be synchronized - GetPendingThreadStopNotification() is used now only within TSC thread and that's why doesn't need synchronization. But if you're going to call it from another thread GetPendingThreadStopNotification should be protected by mutex.
http://reviews.llvm.org/D8906
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the lldb-commits
mailing list