private static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e) { var scc = SystemClockChanged; if (scc != null) { scc(sender, e); } }
private static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e) { lock (s_systemClockChanged) { foreach (var entry in s_systemClockChanged) { if (entry.TryGetTarget(out var scheduler)) { scheduler.SystemClockChanged(sender, e); } } } }
internal static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e) { lock (SystemClockChanged) { // create a defensive copy as the callbacks may change the hashset var copySystemClockChanged = new List <WeakReference <LocalScheduler> >(SystemClockChanged); foreach (var entry in copySystemClockChanged) { if (entry.TryGetTarget(out var scheduler)) { scheduler.SystemClockChanged(sender, e); } } } }
private static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e) { lock (s_systemClockChanged) { foreach (var entry in s_systemClockChanged) { #if NO_WEAKREFOFT var scheduler = entry.Target as LocalScheduler; if (scheduler != null) #else var scheduler = default(LocalScheduler); if (entry.TryGetTarget(out scheduler)) #endif { scheduler.SystemClockChanged(sender, e); } } } }
private static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e) { var scc = SystemClockChanged; if (scc != null) scc(sender, e); }