public static void WaitIfLocked(this IOException ex, int ms) { if (ex.IsLocked()) { if (ms > 0) { System.Threading.Thread.Sleep(ms); } } else { throw ex; } }
/// <summary> /// Wait current thread for N milliseconds if exception is about Locking /// </summary> public static void WaitIfLocked(this IOException ex, int timerInMilliseconds) { if (ex.IsLocked()) { if (timerInMilliseconds > 0) { System.Threading.Tasks.Task.Delay(timerInMilliseconds).Wait(); } } else { throw ex; } }
public static void WaitIfLocked(this IOException ex, int timer) { if (ex.IsLocked()) { if (timer > 0) { WaitFor(timer); } } else { throw ex; } }