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 - Breaking a code in a single thread

The work to be done and run in a new thread is programmed in the DoWork event handler. To understand how it works, the best we can do is to see it in action and experience the difference between the code running in the same thread (the application's main thread) and in another thread.

Imagine that we must create a Codebreaker Application. There is a code of four Unicode characters, and we want to break it by a brute force attack. Therefore, we must loop through each Unicode character until we have a match, then move on to the next character and so on.

However, as the application will take some time to break the code, we do not want to get caught by a guard during the hacking process. Therefore, ...

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