diff options
author | Jim Ingham <jingham@apple.com> | 2012-12-11 02:31:48 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-12-11 02:31:48 +0000 |
commit | c3faa19577355978075a2124b29e400f8ca17f12 (patch) | |
tree | f037ca301ceb4a722d3def0bfb1cb2b48449b461 /lldb/source/Target/ThreadList.cpp | |
parent | c953a6a5ebf58b58ee99196214512c468b035b39 (diff) | |
download | bcm5719-llvm-c3faa19577355978075a2124b29e400f8ca17f12.tar.gz bcm5719-llvm-c3faa19577355978075a2124b29e400f8ca17f12.zip |
Broadcast an event when the selected thread is changed.
<rdar://problem/10976636>
llvm-svn: 169810
Diffstat (limited to 'lldb/source/Target/ThreadList.cpp')
-rw-r--r-- | lldb/source/Target/ThreadList.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index fe38b5769f9..9ce772e5a36 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -555,7 +555,7 @@ ThreadList::GetSelectedThread () } bool -ThreadList::SetSelectedThreadByID (lldb::tid_t tid) +ThreadList::SetSelectedThreadByID (lldb::tid_t tid, bool notify) { Mutex::Locker locker(m_threads_mutex); ThreadSP selected_thread_sp(FindThreadByID(tid)); @@ -567,11 +567,14 @@ ThreadList::SetSelectedThreadByID (lldb::tid_t tid) else m_selected_tid = LLDB_INVALID_THREAD_ID; + if (notify) + NotifySelectedThreadChanged(m_selected_tid); + return m_selected_tid != LLDB_INVALID_THREAD_ID; } bool -ThreadList::SetSelectedThreadByIndexID (uint32_t index_id) +ThreadList::SetSelectedThreadByIndexID (uint32_t index_id, bool notify) { Mutex::Locker locker(m_threads_mutex); ThreadSP selected_thread_sp (FindThreadByIndexID(index_id)); @@ -583,10 +586,22 @@ ThreadList::SetSelectedThreadByIndexID (uint32_t index_id) else m_selected_tid = LLDB_INVALID_THREAD_ID; + if (notify) + NotifySelectedThreadChanged(m_selected_tid); + return m_selected_tid != LLDB_INVALID_THREAD_ID; } void +ThreadList::NotifySelectedThreadChanged (lldb::tid_t tid) +{ + ThreadSP selected_thread_sp (FindThreadByID(tid)); + if (selected_thread_sp->EventTypeHasListeners(Thread::eBroadcastBitThreadSelected)) + selected_thread_sp->BroadcastEvent(Thread::eBroadcastBitThreadSelected, + new Thread::ThreadEventData(selected_thread_sp)); +} + +void ThreadList::Update (ThreadList &rhs) { if (this != &rhs) |