Skip to content

Instantly share code, notes, and snippets.

View musoftware's full-sized avatar
🌏
Working from home

Musoftware musoftware

🌏
Working from home
View GitHub Profile
@musoftware
musoftware / avoid_hang_UI.cs
Last active June 24, 2022 18:36
While you make invoke to control from many many threads , the UI will hang
internal class AvoidHang : IDisposable
{
private readonly SemaphoreSlim _semaphore = new System.Threading.SemaphoreSlim(1, 1);
public void Dispose()
{
_semaphore.Dispose();
}
public void ToAvoidHang(int fast = 1000, Action action = null)