1 //===-- ThreadList.cpp ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
16 // Other libraries and framework includes
18 #include "lldb/Core/State.h"
19 #include "lldb/Target/Process.h"
20 #include "lldb/Target/RegisterContext.h"
21 #include "lldb/Target/Thread.h"
22 #include "lldb/Target/ThreadList.h"
23 #include "lldb/Target/ThreadPlan.h"
24 #include "lldb/Utility/LLDBAssert.h"
25 #include "lldb/Utility/Log.h"
28 using namespace lldb_private;
30 ThreadList::ThreadList(Process *process)
31 : ThreadCollection(), m_process(process), m_stop_id(0),
32 m_selected_tid(LLDB_INVALID_THREAD_ID) {}
34 ThreadList::ThreadList(const ThreadList &rhs)
35 : ThreadCollection(), m_process(rhs.m_process), m_stop_id(rhs.m_stop_id),
37 // Use the assignment operator since it uses the mutex
41 const ThreadList &ThreadList::operator=(const ThreadList &rhs) {
43 // Lock both mutexes to make sure neither side changes anyone on us while
44 // the assignment occurs
45 std::lock_guard<std::recursive_mutex> guard(GetMutex());
46 std::lock_guard<std::recursive_mutex> rhs_guard(rhs.GetMutex());
48 m_process = rhs.m_process;
49 m_stop_id = rhs.m_stop_id;
50 m_threads = rhs.m_threads;
51 m_selected_tid = rhs.m_selected_tid;
56 ThreadList::~ThreadList() {
57 // Clear the thread list. Clear will take the mutex lock which will ensure
58 // that if anyone is using the list they won't get it removed while using it.
62 lldb::ThreadSP ThreadList::GetExpressionExecutionThread() {
63 if (m_expression_tid_stack.empty())
64 return GetSelectedThread();
65 ThreadSP expr_thread_sp = FindThreadByID(m_expression_tid_stack.back());
67 return expr_thread_sp;
69 return GetSelectedThread();
72 void ThreadList::PushExpressionExecutionThread(lldb::tid_t tid) {
73 m_expression_tid_stack.push_back(tid);
76 void ThreadList::PopExpressionExecutionThread(lldb::tid_t tid) {
77 assert(m_expression_tid_stack.back() == tid);
78 m_expression_tid_stack.pop_back();
81 uint32_t ThreadList::GetStopID() const { return m_stop_id; }
83 void ThreadList::SetStopID(uint32_t stop_id) { m_stop_id = stop_id; }
85 uint32_t ThreadList::GetSize(bool can_update) {
86 std::lock_guard<std::recursive_mutex> guard(GetMutex());
89 m_process->UpdateThreadListIfNeeded();
90 return m_threads.size();
93 ThreadSP ThreadList::GetThreadAtIndex(uint32_t idx, bool can_update) {
94 std::lock_guard<std::recursive_mutex> guard(GetMutex());
97 m_process->UpdateThreadListIfNeeded();
100 if (idx < m_threads.size())
101 thread_sp = m_threads[idx];
105 ThreadSP ThreadList::FindThreadByID(lldb::tid_t tid, bool can_update) {
106 std::lock_guard<std::recursive_mutex> guard(GetMutex());
109 m_process->UpdateThreadListIfNeeded();
113 const uint32_t num_threads = m_threads.size();
114 for (idx = 0; idx < num_threads; ++idx) {
115 if (m_threads[idx]->GetID() == tid) {
116 thread_sp = m_threads[idx];
123 ThreadSP ThreadList::FindThreadByProtocolID(lldb::tid_t tid, bool can_update) {
124 std::lock_guard<std::recursive_mutex> guard(GetMutex());
127 m_process->UpdateThreadListIfNeeded();
131 const uint32_t num_threads = m_threads.size();
132 for (idx = 0; idx < num_threads; ++idx) {
133 if (m_threads[idx]->GetProtocolID() == tid) {
134 thread_sp = m_threads[idx];
141 ThreadSP ThreadList::RemoveThreadByID(lldb::tid_t tid, bool can_update) {
142 std::lock_guard<std::recursive_mutex> guard(GetMutex());
145 m_process->UpdateThreadListIfNeeded();
149 const uint32_t num_threads = m_threads.size();
150 for (idx = 0; idx < num_threads; ++idx) {
151 if (m_threads[idx]->GetID() == tid) {
152 thread_sp = m_threads[idx];
153 m_threads.erase(m_threads.begin() + idx);
160 ThreadSP ThreadList::RemoveThreadByProtocolID(lldb::tid_t tid,
162 std::lock_guard<std::recursive_mutex> guard(GetMutex());
165 m_process->UpdateThreadListIfNeeded();
169 const uint32_t num_threads = m_threads.size();
170 for (idx = 0; idx < num_threads; ++idx) {
171 if (m_threads[idx]->GetProtocolID() == tid) {
172 thread_sp = m_threads[idx];
173 m_threads.erase(m_threads.begin() + idx);
180 ThreadSP ThreadList::GetThreadSPForThreadPtr(Thread *thread_ptr) {
183 std::lock_guard<std::recursive_mutex> guard(GetMutex());
186 const uint32_t num_threads = m_threads.size();
187 for (idx = 0; idx < num_threads; ++idx) {
188 if (m_threads[idx].get() == thread_ptr) {
189 thread_sp = m_threads[idx];
197 ThreadSP ThreadList::GetBackingThread(const ThreadSP &real_thread) {
198 std::lock_guard<std::recursive_mutex> guard(GetMutex());
201 const uint32_t num_threads = m_threads.size();
202 for (uint32_t idx = 0; idx < num_threads; ++idx) {
203 if (m_threads[idx]->GetBackingThread() == real_thread) {
204 thread_sp = m_threads[idx];
211 ThreadSP ThreadList::FindThreadByIndexID(uint32_t index_id, bool can_update) {
212 std::lock_guard<std::recursive_mutex> guard(GetMutex());
215 m_process->UpdateThreadListIfNeeded();
218 const uint32_t num_threads = m_threads.size();
219 for (uint32_t idx = 0; idx < num_threads; ++idx) {
220 if (m_threads[idx]->GetIndexID() == index_id) {
221 thread_sp = m_threads[idx];
228 bool ThreadList::ShouldStop(Event *event_ptr) {
229 // Running events should never stop, obviously...
231 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
233 // The ShouldStop method of the threads can do a whole lot of work, figuring
234 // out whether the thread plan conditions are met. So we don't want to keep
235 // the ThreadList locked the whole time we are doing this.
236 // FIXME: It is possible that running code could cause new threads
237 // to be created. If that happens, we will miss asking them whether they
238 // should stop. This is not a big deal since we haven't had a chance to hang
239 // any interesting operations on those threads yet.
241 collection threads_copy;
244 std::lock_guard<std::recursive_mutex> guard(GetMutex());
246 m_process->UpdateThreadListIfNeeded();
247 for (lldb::ThreadSP thread_sp : m_threads) {
248 // This is an optimization... If we didn't let a thread run in between
249 // the previous stop and this one, we shouldn't have to consult it for
250 // ShouldStop. So just leave it off the list we are going to inspect. On
251 // Linux, if a thread-specific conditional breakpoint was hit, it won't
252 // necessarily be the thread that hit the breakpoint itself that
253 // evaluates the conditional expression, so the thread that hit the
254 // breakpoint could still be asked to stop, even though it hasn't been
255 // allowed to run since the previous stop.
256 if (thread_sp->GetTemporaryResumeState() != eStateSuspended ||
257 thread_sp->IsStillAtLastBreakpointHit())
258 threads_copy.push_back(thread_sp);
261 // It is possible the threads we were allowing to run all exited and then
262 // maybe the user interrupted or something, then fall back on looking at
265 if (threads_copy.size() == 0)
266 threads_copy = m_threads;
269 collection::iterator pos, end = threads_copy.end();
273 log->Printf("ThreadList::%s: %" PRIu64 " threads, %" PRIu64
274 " unsuspended threads",
275 __FUNCTION__, (uint64_t)m_threads.size(),
276 (uint64_t)threads_copy.size());
279 bool did_anybody_stop_for_a_reason = false;
281 // If the event is an Interrupt event, then we're going to stop no matter
282 // what. Otherwise, presume we won't stop.
283 bool should_stop = false;
284 if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
287 "ThreadList::%s handling interrupt event, should stop set to true",
293 // Now we run through all the threads and get their stop info's. We want to
294 // make sure to do this first before we start running the ShouldStop, because
295 // one thread's ShouldStop could destroy information (like deleting a thread
296 // specific breakpoint another thread had stopped at) which could lead us to
297 // compute the StopInfo incorrectly. We don't need to use it here, we just
298 // want to make sure it gets computed.
300 for (pos = threads_copy.begin(); pos != end; ++pos) {
301 ThreadSP thread_sp(*pos);
302 thread_sp->GetStopInfo();
305 for (pos = threads_copy.begin(); pos != end; ++pos) {
306 ThreadSP thread_sp(*pos);
308 // We should never get a stop for which no thread had a stop reason, but
309 // sometimes we do see this - for instance when we first connect to a
310 // remote stub. In that case we should stop, since we can't figure out the
311 // right thing to do and stopping gives the user control over what to do in
314 // Note, this causes a problem when you have a thread specific breakpoint,
315 // and a bunch of threads hit the breakpoint, but not the thread which we
316 // are waiting for. All the threads that are not "supposed" to hit the
317 // breakpoint are marked as having no stop reason, which is right, they
318 // should not show a stop reason. But that triggers this code and causes
319 // us to stop seemingly for no reason.
321 // Since the only way we ever saw this error was on first attach, I'm only
322 // going to trigger set did_anybody_stop_for_a_reason to true unless this
323 // is the first stop.
325 // If this becomes a problem, we'll have to have another StopReason like
326 // "StopInfoHidden" which will look invalid everywhere but at this check.
328 if (thread_sp->GetProcess()->GetStopID() > 1)
329 did_anybody_stop_for_a_reason = true;
331 did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason();
333 const bool thread_should_stop = thread_sp->ShouldStop(event_ptr);
334 if (thread_should_stop)
338 if (!should_stop && !did_anybody_stop_for_a_reason) {
341 log->Printf("ThreadList::%s we stopped but no threads had a stop reason, "
342 "overriding should_stop and stopping.",
347 log->Printf("ThreadList::%s overall should_stop = %i", __FUNCTION__,
351 for (pos = threads_copy.begin(); pos != end; ++pos) {
352 ThreadSP thread_sp(*pos);
353 thread_sp->WillStop();
360 Vote ThreadList::ShouldReportStop(Event *event_ptr) {
361 std::lock_guard<std::recursive_mutex> guard(GetMutex());
363 Vote result = eVoteNoOpinion;
364 m_process->UpdateThreadListIfNeeded();
365 collection::iterator pos, end = m_threads.end();
367 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
370 log->Printf("ThreadList::%s %" PRIu64 " threads", __FUNCTION__,
371 (uint64_t)m_threads.size());
373 // Run through the threads and ask whether we should report this event. For
374 // stopping, a YES vote wins over everything. A NO vote wins over NO
376 for (pos = m_threads.begin(); pos != end; ++pos) {
377 ThreadSP thread_sp(*pos);
378 const Vote vote = thread_sp->ShouldReportStop(event_ptr);
388 if (result == eVoteNoOpinion) {
392 "Thread {0:x} voted {1}, but lost out because result was {2}",
393 thread_sp->GetID(), vote, result);
398 LLDB_LOG(log, "Returning {0}", result);
402 void ThreadList::SetShouldReportStop(Vote vote) {
403 std::lock_guard<std::recursive_mutex> guard(GetMutex());
405 m_process->UpdateThreadListIfNeeded();
406 collection::iterator pos, end = m_threads.end();
407 for (pos = m_threads.begin(); pos != end; ++pos) {
408 ThreadSP thread_sp(*pos);
409 thread_sp->SetShouldReportStop(vote);
413 Vote ThreadList::ShouldReportRun(Event *event_ptr) {
415 std::lock_guard<std::recursive_mutex> guard(GetMutex());
417 Vote result = eVoteNoOpinion;
418 m_process->UpdateThreadListIfNeeded();
419 collection::iterator pos, end = m_threads.end();
421 // Run through the threads and ask whether we should report this event. The
422 // rule is NO vote wins over everything, a YES vote wins over no opinion.
424 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
426 for (pos = m_threads.begin(); pos != end; ++pos) {
427 if ((*pos)->GetResumeState() != eStateSuspended) {
428 switch ((*pos)->ShouldReportRun(event_ptr)) {
432 if (result == eVoteNoOpinion)
437 log->Printf("ThreadList::ShouldReportRun() thread %d (0x%4.4" PRIx64
438 ") says don't report.",
439 (*pos)->GetIndexID(), (*pos)->GetID());
448 void ThreadList::Clear() {
449 std::lock_guard<std::recursive_mutex> guard(GetMutex());
452 m_selected_tid = LLDB_INVALID_THREAD_ID;
455 void ThreadList::Destroy() {
456 std::lock_guard<std::recursive_mutex> guard(GetMutex());
457 const uint32_t num_threads = m_threads.size();
458 for (uint32_t idx = 0; idx < num_threads; ++idx) {
459 m_threads[idx]->DestroyThread();
463 void ThreadList::RefreshStateAfterStop() {
464 std::lock_guard<std::recursive_mutex> guard(GetMutex());
466 m_process->UpdateThreadListIfNeeded();
468 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
469 if (log && log->GetVerbose())
470 log->Printf("Turning off notification of new threads while single stepping "
473 collection::iterator pos, end = m_threads.end();
474 for (pos = m_threads.begin(); pos != end; ++pos)
475 (*pos)->RefreshStateAfterStop();
478 void ThreadList::DiscardThreadPlans() {
479 // You don't need to update the thread list here, because only threads that
480 // you currently know about have any thread plans.
481 std::lock_guard<std::recursive_mutex> guard(GetMutex());
483 collection::iterator pos, end = m_threads.end();
484 for (pos = m_threads.begin(); pos != end; ++pos)
485 (*pos)->DiscardThreadPlans(true);
488 bool ThreadList::WillResume() {
489 // Run through the threads and perform their momentary actions. But we only
490 // do this for threads that are running, user suspended threads stay where
493 std::lock_guard<std::recursive_mutex> guard(GetMutex());
494 m_process->UpdateThreadListIfNeeded();
496 collection::iterator pos, end = m_threads.end();
498 // See if any thread wants to run stopping others. If it does, then we won't
499 // setup the other threads for resume, since they aren't going to get a
500 // chance to run. This is necessary because the SetupForResume might add
501 // "StopOthers" plans which would then get to be part of the who-gets-to-run
502 // negotiation, but they're coming in after the fact, and the threads that
503 // are already set up should take priority.
505 bool wants_solo_run = false;
507 for (pos = m_threads.begin(); pos != end; ++pos) {
508 lldbassert((*pos)->GetCurrentPlan() &&
509 "thread should not have null thread plan");
510 if ((*pos)->GetResumeState() != eStateSuspended &&
511 (*pos)->GetCurrentPlan()->StopOthers()) {
512 if ((*pos)->IsOperatingSystemPluginThread() &&
513 !(*pos)->GetBackingThread())
515 wants_solo_run = true;
520 if (wants_solo_run) {
521 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
522 if (log && log->GetVerbose())
523 log->Printf("Turning on notification of new threads while single "
524 "stepping a thread.");
525 m_process->StartNoticingNewThreads();
527 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
528 if (log && log->GetVerbose())
529 log->Printf("Turning off notification of new threads while single "
530 "stepping a thread.");
531 m_process->StopNoticingNewThreads();
534 // Give all the threads that are likely to run a last chance to set up their
535 // state before we negotiate who is actually going to get a chance to run...
536 // Don't set to resume suspended threads, and if any thread wanted to stop
537 // others, only call setup on the threads that request StopOthers...
539 for (pos = m_threads.begin(); pos != end; ++pos) {
540 if ((*pos)->GetResumeState() != eStateSuspended &&
541 (!wants_solo_run || (*pos)->GetCurrentPlan()->StopOthers())) {
542 if ((*pos)->IsOperatingSystemPluginThread() &&
543 !(*pos)->GetBackingThread())
545 (*pos)->SetupForResume();
549 // Now go through the threads and see if any thread wants to run just itself.
550 // if so then pick one and run it.
552 ThreadList run_me_only_list(m_process);
554 run_me_only_list.SetStopID(m_process->GetStopID());
556 bool run_only_current_thread = false;
558 for (pos = m_threads.begin(); pos != end; ++pos) {
559 ThreadSP thread_sp(*pos);
560 if (thread_sp->GetResumeState() != eStateSuspended &&
561 thread_sp->GetCurrentPlan()->StopOthers()) {
562 if ((*pos)->IsOperatingSystemPluginThread() &&
563 !(*pos)->GetBackingThread())
566 // You can't say "stop others" and also want yourself to be suspended.
567 assert(thread_sp->GetCurrentPlan()->RunState() != eStateSuspended);
569 if (thread_sp == GetSelectedThread()) {
570 // If the currently selected thread wants to run on its own, always let
572 run_only_current_thread = true;
573 run_me_only_list.Clear();
574 run_me_only_list.AddThread(thread_sp);
578 run_me_only_list.AddThread(thread_sp);
582 bool need_to_resume = true;
584 if (run_me_only_list.GetSize(false) == 0) {
585 // Everybody runs as they wish:
586 for (pos = m_threads.begin(); pos != end; ++pos) {
587 ThreadSP thread_sp(*pos);
589 if (thread_sp->GetResumeState() != eStateSuspended)
590 run_state = thread_sp->GetCurrentPlan()->RunState();
592 run_state = eStateSuspended;
593 if (!thread_sp->ShouldResume(run_state))
594 need_to_resume = false;
597 ThreadSP thread_to_run;
599 if (run_only_current_thread) {
600 thread_to_run = GetSelectedThread();
601 } else if (run_me_only_list.GetSize(false) == 1) {
602 thread_to_run = run_me_only_list.GetThreadAtIndex(0);
605 (int)((run_me_only_list.GetSize(false) * (double)rand()) /
607 thread_to_run = run_me_only_list.GetThreadAtIndex(random_thread);
610 for (pos = m_threads.begin(); pos != end; ++pos) {
611 ThreadSP thread_sp(*pos);
612 if (thread_sp == thread_to_run) {
613 if (!thread_sp->ShouldResume(thread_sp->GetCurrentPlan()->RunState()))
614 need_to_resume = false;
616 thread_sp->ShouldResume(eStateSuspended);
620 return need_to_resume;
623 void ThreadList::DidResume() {
624 std::lock_guard<std::recursive_mutex> guard(GetMutex());
625 collection::iterator pos, end = m_threads.end();
626 for (pos = m_threads.begin(); pos != end; ++pos) {
627 // Don't clear out threads that aren't going to get a chance to run, rather
628 // leave their state for the next time around.
629 ThreadSP thread_sp(*pos);
630 if (thread_sp->GetResumeState() != eStateSuspended)
631 thread_sp->DidResume();
635 void ThreadList::DidStop() {
636 std::lock_guard<std::recursive_mutex> guard(GetMutex());
637 collection::iterator pos, end = m_threads.end();
638 for (pos = m_threads.begin(); pos != end; ++pos) {
639 // Notify threads that the process just stopped. Note, this currently
640 // assumes that all threads in the list stop when the process stops. In
641 // the future we will want to support a debugging model where some threads
642 // continue to run while others are stopped. We either need to handle that
643 // somehow here or create a special thread list containing only threads
644 // which will stop in the code that calls this method (currently
645 // Process::SetPrivateState).
646 ThreadSP thread_sp(*pos);
647 if (StateIsRunningState(thread_sp->GetState()))
648 thread_sp->DidStop();
652 ThreadSP ThreadList::GetSelectedThread() {
653 std::lock_guard<std::recursive_mutex> guard(GetMutex());
654 ThreadSP thread_sp = FindThreadByID(m_selected_tid);
655 if (!thread_sp.get()) {
656 if (m_threads.size() == 0)
658 m_selected_tid = m_threads[0]->GetID();
659 thread_sp = m_threads[0];
664 bool ThreadList::SetSelectedThreadByID(lldb::tid_t tid, bool notify) {
665 std::lock_guard<std::recursive_mutex> guard(GetMutex());
666 ThreadSP selected_thread_sp(FindThreadByID(tid));
667 if (selected_thread_sp) {
668 m_selected_tid = tid;
669 selected_thread_sp->SetDefaultFileAndLineToSelectedFrame();
671 m_selected_tid = LLDB_INVALID_THREAD_ID;
674 NotifySelectedThreadChanged(m_selected_tid);
676 return m_selected_tid != LLDB_INVALID_THREAD_ID;
679 bool ThreadList::SetSelectedThreadByIndexID(uint32_t index_id, bool notify) {
680 std::lock_guard<std::recursive_mutex> guard(GetMutex());
681 ThreadSP selected_thread_sp(FindThreadByIndexID(index_id));
682 if (selected_thread_sp.get()) {
683 m_selected_tid = selected_thread_sp->GetID();
684 selected_thread_sp->SetDefaultFileAndLineToSelectedFrame();
686 m_selected_tid = LLDB_INVALID_THREAD_ID;
689 NotifySelectedThreadChanged(m_selected_tid);
691 return m_selected_tid != LLDB_INVALID_THREAD_ID;
694 void ThreadList::NotifySelectedThreadChanged(lldb::tid_t tid) {
695 ThreadSP selected_thread_sp(FindThreadByID(tid));
696 if (selected_thread_sp->EventTypeHasListeners(
697 Thread::eBroadcastBitThreadSelected))
698 selected_thread_sp->BroadcastEvent(
699 Thread::eBroadcastBitThreadSelected,
700 new Thread::ThreadEventData(selected_thread_sp));
703 void ThreadList::Update(ThreadList &rhs) {
705 // Lock both mutexes to make sure neither side changes anyone on us while
706 // the assignment occurs
707 std::lock_guard<std::recursive_mutex> guard(GetMutex());
709 m_process = rhs.m_process;
710 m_stop_id = rhs.m_stop_id;
711 m_threads.swap(rhs.m_threads);
712 m_selected_tid = rhs.m_selected_tid;
714 // Now we look for threads that we are done with and make sure to clear
715 // them up as much as possible so anyone with a shared pointer will still
716 // have a reference, but the thread won't be of much use. Using
717 // std::weak_ptr for all backward references (such as a thread to a
718 // process) will eventually solve this issue for us, but for now, we need
719 // to work around the issue
720 collection::iterator rhs_pos, rhs_end = rhs.m_threads.end();
721 for (rhs_pos = rhs.m_threads.begin(); rhs_pos != rhs_end; ++rhs_pos) {
722 const lldb::tid_t tid = (*rhs_pos)->GetID();
723 bool thread_is_alive = false;
724 const uint32_t num_threads = m_threads.size();
725 for (uint32_t idx = 0; idx < num_threads; ++idx) {
726 ThreadSP backing_thread = m_threads[idx]->GetBackingThread();
727 if (m_threads[idx]->GetID() == tid ||
728 (backing_thread && backing_thread->GetID() == tid)) {
729 thread_is_alive = true;
733 if (!thread_is_alive)
734 (*rhs_pos)->DestroyThread();
739 void ThreadList::Flush() {
740 std::lock_guard<std::recursive_mutex> guard(GetMutex());
741 collection::iterator pos, end = m_threads.end();
742 for (pos = m_threads.begin(); pos != end; ++pos)
746 std::recursive_mutex &ThreadList::GetMutex() const {
747 return m_process->m_thread_mutex;
750 ThreadList::ExpressionExecutionThreadPusher::ExpressionExecutionThreadPusher(
751 lldb::ThreadSP thread_sp)
752 : m_thread_list(nullptr), m_tid(LLDB_INVALID_THREAD_ID) {
754 m_tid = thread_sp->GetID();
755 m_thread_list = &thread_sp->GetProcess()->GetThreadList();
756 m_thread_list->PushExpressionExecutionThread(m_tid);