summaryrefslogtreecommitdiff
path: root/src/vm/eventpipeconfiguration.cpp
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2017-05-16 17:11:47 -0700
committerGitHub <noreply@github.com>2017-05-16 17:11:47 -0700
commit40b87c9810c31fb6ab471a44b5735408269ce6ba (patch)
tree144465f0ad9ddf55d274114e0ac77c7ba615a298 /src/vm/eventpipeconfiguration.cpp
parent36e988ee6593351f1e962118a99154df5eae0254 (diff)
downloadcoreclr-40b87c9810c31fb6ab471a44b5735408269ce6ba.tar.gz
coreclr-40b87c9810c31fb6ab471a44b5735408269ce6ba.tar.bz2
coreclr-40b87c9810c31fb6ab471a44b5735408269ce6ba.zip
Allow provider deletion to be deferred until after tracing is stopped. (#11651)
Diffstat (limited to 'src/vm/eventpipeconfiguration.cpp')
-rw-r--r--src/vm/eventpipeconfiguration.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/vm/eventpipeconfiguration.cpp b/src/vm/eventpipeconfiguration.cpp
index a227d9d68a..73379fed1b 100644
--- a/src/vm/eventpipeconfiguration.cpp
+++ b/src/vm/eventpipeconfiguration.cpp
@@ -59,7 +59,7 @@ void EventPipeConfiguration::Initialize()
CONTRACTL_END;
// Create the configuration provider.
- m_pConfigProvider = new EventPipeProvider(s_configurationProviderID);
+ m_pConfigProvider = EventPipe::CreateProvider(s_configurationProviderID);
// Create the metadata event.
m_pMetadataEvent = m_pConfigProvider->AddEvent(
@@ -379,6 +379,33 @@ EventPipeEventInstance* EventPipeConfiguration::BuildEventMetadataEvent(EventPip
return pInstance;
}
+void EventPipeConfiguration::DeleteDeferredProviders()
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_ANY;
+ // Lock must be held by EventPipe::Disable.
+ PRECONDITION(EventPipe::GetLock()->OwnedByCurrentThread());
+
+ }
+ CONTRACTL_END;
+
+ SListElem<EventPipeProvider*> *pElem = m_pProviderList->GetHead();
+ while(pElem != NULL)
+ {
+ EventPipeProvider *pProvider = pElem->GetValue();
+ if(pProvider->GetDeleteDeferred())
+ {
+ // The act of deleting the provider unregisters it and removes it from the list.
+ delete(pProvider);
+ }
+
+ pElem = m_pProviderList->GetNext(pElem);
+ }
+}
+
EventPipeEnabledProviderList::EventPipeEnabledProviderList(
EventPipeProviderConfiguration *pConfigs,
unsigned int numConfigs)