/// <summary>Gets an enumerable of the tasks currently scheduled on this scheduler.</summary> /// <returns>An enumerable of the tasks currently scheduled.</returns> protected sealed override IEnumerable <Task> GetScheduledTasks() { bool lockTaken = false; try { Monitor.TryEnter(_tasks, ref lockTaken); if (lockTaken) { return(_tasks); } else { throw new NotSupportedException(); } } finally { if (lockTaken) { Monitor.Exit(_tasks); } } }
internal static void TryEnter(object obj, int millisecondsTimeout, ref bool taken) { taken = Monitor.TryEnter(obj, millisecondsTimeout); }
internal static bool TryEnter(object obj, TimeSpan timeout) { return(Monitor.TryEnter(obj, timeout)); }
internal static bool TryEnter(object obj, int millisecondsTimeout) { return(Monitor.TryEnter(obj, millisecondsTimeout)); }
internal static void TryEnter(object obj, ref bool taken) { taken = Monitor.TryEnter(obj); }
internal static bool TryEnter(object obj) { return(Monitor.TryEnter(obj)); }
public static bool TryEnter(object obj, TimeSpan timeout) { return(Monitor.TryEnter(obj, Monitor.MillisecondsTimeoutFromTimeSpan(timeout))); }