Ban usages of Thread#Sleep (#243)

Using Thread.Sleep blocks the _entire_ thread from doing *anything*,
while Task.Delay allows the thread to execute other tasks while the
delay is passing. The inability to cancel Thread.Sleep may also cause
longer shutdowns

tl;dr Thread.Sleep bad, Task.Delay good
made because of
578c03871d

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-12-21 22:21:20 +05:00 committed by GitHub
parent 285763d50d
commit 3134c35751
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,3 +18,5 @@ P:System.DateTime.Now;Use System.DateTime.UtcNow instead.
P:System.DateTimeOffset.Now;Use System.DateTimeOffset.UtcNow instead.
P:System.DateTimeOffset.DateTime;Use System.DateTimeOffset.UtcDateTime instead.
M:System.IO.File.OpenWrite(System.String);File.OpenWrite(string) does not clear the file before writing to it. Use File.Create(string) instead.
M:System.Threading.Thread.Sleep(System.Int32);Use Task.Delay(int, CancellationToken) instead.
M:System.Threading.Thread.Sleep(System.TimeSpan);Use Task.Delay(TimeSpan, CancellationToken) instead.