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

Synchronous execution

On the other hand, we are used to synchronous execution when we work with a single thread. This mechanism executes the next instruction once the current instruction processing is completed.

When a synchronous method is called, it runs in the same thread, and the program flow goes into the method's code. Once it returns from the method with or without a result, it goes on with the instruction next to the method call. There is no code in the method left for later execution, because it had finished when it returned the control to the caller. The main program has to wait for the method to complete its execution in order to go on with the next set of instructions.

This is what happens when you debug a single-threaded application, ...

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