
Introduction
This code demonstrate how easily one can create a asynchronouse processes using .net threading.
Why Use Asynchronouse Threading:
Let' say you have a budle of requests to save data then you need to use threading
other wise system will wait for first request to be completed and then awoke function for sencond request.
By using threading always a new instance of of your function will be created and many instances will be running togeather, and data will be saved parrally from application end.
What you have to do:
Create a function that will be called rapidly.
Suppose
void
SaveUser(int id,string name){...}
Now create a function that will create thread and add this function to it...
void dosave(id,name){<P></P>
<P>t=<FONT color=#0000ff>new</FONT> Thread (<FONT color=#0000ff>new</FONT>
ThreadStart(SaveUser(id,name)));</P>
<P>}</P>
On each request of save data call above function...
dosave(1,"jhon smith");<P></P>
What you have to include to use threading
You have to include threading name space in order to use the threading class.
using System.Threading;
Form1.cs
<FONT color=#0000ff><P></FONT> </P><P><FONT color=#0000ff>private</FONT> <FONT color=#0000ff>void</FONT> Form1_Load(<FONT color=#0000ff>object</FONT> sender, System.EventArgs e)</P><P>{</P><P>
Form2.cs
This form shows the no of time for which a single process is repeating.