summaryrefslogtreecommitdiff
path: root/src/vm/sampleprofiler.cpp
diff options
context:
space:
mode:
authorJosé Rivero <jorive@microsoft.com>2019-02-12 13:54:33 -0800
committerGitHub <noreply@github.com>2019-02-12 13:54:33 -0800
commit8ad7d5e57e0eb0308453895693a996f5a93c8e08 (patch)
tree584edf2b519f424668b1720c74aa90bd0c077f57 /src/vm/sampleprofiler.cpp
parentc4007d88a0c556182f70d7714e5b55cca92331a0 (diff)
downloadcoreclr-8ad7d5e57e0eb0308453895693a996f5a93c8e08.tar.gz
coreclr-8ad7d5e57e0eb0308453895693a996f5a93c8e08.tar.bz2
coreclr-8ad7d5e57e0eb0308453895693a996f5a93c8e08.zip
Bug Fix: Calling System.Diagnostics.Tracing.EventPipe.Enable twice asserts #22247 (#22318)
After disabling EventPipe -> SampleProfiler, we were not closing the thread shutdown event, thus asserting on reentrance of the EventPipe. * Adding regression test, and removing comment. * Waits until the specified object is in the signaled state.
Diffstat (limited to 'src/vm/sampleprofiler.cpp')
-rw-r--r--src/vm/sampleprofiler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vm/sampleprofiler.cpp b/src/vm/sampleprofiler.cpp
index 4548620662..44ab2f8975 100644
--- a/src/vm/sampleprofiler.cpp
+++ b/src/vm/sampleprofiler.cpp
@@ -15,7 +15,7 @@
#include <mmsystem.h>
#endif //FEATURE_PAL
-#define NUM_NANOSECONDS_IN_1_MS (1000000)
+const unsigned long NUM_NANOSECONDS_IN_1_MS = 1000000;
Volatile<BOOL> SampleProfiler::s_profilingEnabled = false;
Thread* SampleProfiler::s_pSamplingThread = NULL;
@@ -48,7 +48,7 @@ void SampleProfiler::Enable()
PRECONDITION(EventPipe::GetLock()->OwnedByCurrentThread());
}
CONTRACTL_END;
-
+
LoadDependencies();
if(s_pEventPipeProvider == NULL)
@@ -121,7 +121,8 @@ void SampleProfiler::Disable()
s_profilingEnabled = false;
// Wait for the sampling thread to clean itself up.
- s_threadShutdownEvent.Wait(0, FALSE /* bAlertable */);
+ s_threadShutdownEvent.Wait(INFINITE, FALSE /* bAlertable */);
+ s_threadShutdownEvent.CloseEvent();
if(s_timePeriodIsSet)
{