O'Reilly logo

C# 2008 and 2005 Threaded Programming: Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Executing the thread synchronously

You have some doubts about the Join method and how it works with the Thread class. As the FBI agents offered you a cappuccino, you believe that there is some time for experiments, before achieving the best performance.

Now, we are going to make a small change to the application to call the Join method again and make a synchronous execution of the encryption thread:

  1. Open the project, SMSEncryption.
  2. Open the Click event in the button butRunInThread and uncomment the line proThreadEncryption.Join(); (now the thread joins the main thread).
  3. Build and run the application.
  4. Enter or copy and paste a very long text (with more than 5,000 lines) in the Textbox labeled Original SMS Messages and click on the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required