Let me describe what I am trying to achieve. I am programming in C#.
I have a function (method) DoCalculations(). I want to call this DoCalculations() method recursively. However, in C# I get exception as unhandled exception System.StackOverflow. So, I am trying to run DoCalculations() method on a back ground thread.
On FORM LOAD event. I have done following:-
Thread objThread = new Thread(new ThreadStart(DoCalculations));
On START BUTTON CLICK event. I am starting the Thread as follows.
objThread.IsBackground = true;
objThread.Start();
while (!objThread.IsAlive)
{
}
And I intend to run method DoCalculations() continuously with above While Loop.
DoCalculations()
{
//some calculations.
}
I do get control in DoCalculations() method one time. However, I want to do this every instant.
Please if any one can assist me with regards to back ground thread, or is there any better way to achieve to do parallel computation.
I have used above approach in VB.NET, making me more confused why its not working in C#.NET
Any assistance, comments greatly appreciated.
Thanks AP