diff options
author | Andrew Au <andrewau@microsoft.com> | 2017-07-21 21:43:08 +0300 |
---|---|---|
committer | Andrew Au <andrewau@microsoft.com> | 2017-07-21 21:43:08 +0300 |
commit | b683cb0f59d4ac42a2a26d8f66efff60374d85ca (patch) | |
tree | 7f3548277d066dd70b9a676b8cbabc257a6437f6 /src/Native/Runtime/threadstore.cpp | |
parent | 36e79f6ae5a47841844be27969d990f007b5b5a9 (diff) |
CrossThreadDependency2 - firing an interpreting the FuncEvalCrossThreadDependency event
[tfs-changeset: 1667285]
Diffstat (limited to 'src/Native/Runtime/threadstore.cpp')
-rw-r--r-- | src/Native/Runtime/threadstore.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Native/Runtime/threadstore.cpp b/src/Native/Runtime/threadstore.cpp index f37e46369..dcdcb564c 100644 --- a/src/Native/Runtime/threadstore.cpp +++ b/src/Native/Runtime/threadstore.cpp @@ -29,6 +29,9 @@ #include "slist.inl" #include "GCMemoryHelpers.h" +#include "Debug.h" +#include "DebugEventSource.h" + EXTERN_C volatile UInt32 RhpTrapThreads = (UInt32)TrapThreadsFlags::None; GVAL_IMPL_INIT(PTR_Thread, RhpSuspendingThread, 0); @@ -199,7 +202,21 @@ void ThreadStore::UnlockThreadStore() } void ThreadStore::SuspendAllThreads(CLREventStatic* pCompletionEvent) -{ +{ + // + // SuspendAllThreads requires all threads running + // + // Threads are by default frozen by the debugger during FuncEval + // Therefore, in case of FuncEval, we need to inform the debugger + // to unfreeze the threads. + // + struct DebuggerResponse crossThreadDependencyEventPayload; + crossThreadDependencyEventPayload.kind = DebuggerResponseKind::FuncEvalCrossThreadDependency; + DebugEventSource::SendCustomEvent(&crossThreadDependencyEventPayload, sizeof(struct DebuggerResponse)); + + // TODO, FuncEval, avoid firing the event unless we know it is FuncEval in progress + // TODO, FuncEval, what if user refuses to resume all threads? + Thread * pThisThread = GetCurrentThreadIfAvailable(); LockThreadStore(); |