Answers for "pause and resume thread C#"

C#
0

pause and resume thread C#

var mrse = new ManualResetEvent(false);

public void Run() 
{ 
    while (true) 
    { 
        mrse.WaitOne();
        printMessageOnGui("Hey"); 
        Thread.Sleep(2000); . . 
    } 
}

public void Resume() => mrse.Set();
public void Pause() => mrse.Reset();
Posted by: Guest on October-18-2021

C# Answers by Framework

Browse Popular Code Answers by Language