"Deadlock Solution"

internal static void TriggerSafetyShutdown() {
	Action safetyShutdownLocal;
	lock (eventDispatcherSyncObj) {
		safetyShutdownLocal = safetyShutdown;
	}
	if (safetyShutdownLocal != null) safetyShutdownLocal();
}


Code snippet taken from "Common Multithreading Mistakes in C# - I: Incorrect Granularity".