Skip to content

Commit

Permalink
Take EventListener.EventListenersLock in EventPipeEventDispatcher.Sen…
Browse files Browse the repository at this point in the history
…dCommand (dotnet#79185)
  • Loading branch information
davmason authored Dec 13, 2022
1 parent d8e1ec6 commit d79d2df
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,23 @@ private EventPipeEventDispatcher()

internal void SendCommand(EventListener eventListener, EventCommand command, bool enable, EventLevel level, EventKeywords matchAnyKeywords)
{
if (command == EventCommand.Update && enable)
lock (EventListener.EventListenersLock)
{
lock (m_dispatchControlLock)
if (command == EventCommand.Update && enable)
{
// Add the new subscription. This will overwrite an existing subscription for the listener if one exists.
m_subscriptions[eventListener] = new EventListenerSubscription(matchAnyKeywords, level);
lock (m_dispatchControlLock)
{
// Add the new subscription. This will overwrite an existing subscription for the listener if one exists.
m_subscriptions[eventListener] = new EventListenerSubscription(matchAnyKeywords, level);

// Commit the configuration change.
CommitDispatchConfiguration();
// Commit the configuration change.
CommitDispatchConfiguration();
}
}
else if (command == EventCommand.Update && !enable)
{
RemoveEventListener(eventListener);
}
}
else if (command == EventCommand.Update && !enable)
{
RemoveEventListener(eventListener);
}
}

Expand Down

0 comments on commit d79d2df

Please sign in to comment.