Talifun.Commander.Command.CommanderManager.RaiseOnCommanderStoppedEvent C# (CSharp) Méthode

RaiseOnCommanderStoppedEvent() private méthode

Will raise the event on the current thread synchronously. i.e. it will wait until all event handlers have processed the event.
private RaiseOnCommanderStoppedEvent ( CommanderStoppedEventArgs e ) : void
e CommanderStoppedEventArgs The state to be passed to the event.
Résultat void
		private void RaiseOnCommanderStoppedEvent(CommanderStoppedEventArgs e)
		{
			// Make a temporary copy of the event to avoid possibility of
			// a race condition if the last subscriber unsubscribes
			// immediately after the null check and before the event is raised.

			CommanderStoppedEventHandler eventHandler;

			if (!Monitor.TryEnter(_commanderStoppedEventLock, _lockTimeout))
			{
				throw new ApplicationException("Timeout waiting for lock - RaiseOnCommanderStoppedEvent");
			}
			try
			{
				eventHandler = _commanderStoppedEvent;
			}
			finally
			{
				Monitor.Exit(_commanderStoppedEventLock);
			}

			OnCommanderStoppedEvent(e);

			if (eventHandler != null)
			{
				eventHandler(this, e);
			}
		}
		#endregion