Tuesday, March 23, 2010

Difference between Synchronous and Asynchronous events

Usually the methods are synchronous. That means that you call them, they gets executed. And when they finish you get the control back.
Synchronous methods will be the ones you use more often. They are easy to write and easy to use. In most of the cases they do the job just nice.

The asynchronous methods are different. You call them. They start executing, but return the control over the execution back to the thread which called them while they continue to execute in different thread.
Asynchronous methods have the advantage to not interrupt the program flow when a time consuming operation is needed. They are used a bit harder and have to be used carefully. You can not be sure that the execution of a method is finished, and the result is ready to use (unless you do checks). A good use is to call an asynchronous method, continue executing the application, and when the results of the method execution must be used, a loop like the one

1 comment:

  1. You should taκе рагt іn а cоntest for onе of the hіghеѕt quаlity websites on the net.
    I'm going to recommend this website!

    My blog post - shrink hemorrhoids