Multithreading .NET (III)

By | 21 August, 2013

So now a very good practice would be to go back to the first dummy app (MDPA4W) and do just a bit of refactoring.

Basically, I’ll locate the statement of the Sleep method inside another one which signature is called takeARest. Then I’ll instantiate a thread that takes advantage of that, and just run it.

  private void button1_Click(object sender, EventArgs e)
        {
            Thread t1 = new Thread(takeARest);
            t1.Start();
        }

        void takeARest()
        {
            Thread.Sleep(6000);
        }

So we have faced the problem arisen before. Our performance is now fully functional!

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Leave a Reply

Your email address will not be published.