If you want to run 2 loops at the Very same time in C++, will backgroundworkers have this functionality ?
An example could be how I have set up it in this code.
What I wonder is if the backgroundWorker1 first is executed and when this is finished, then backgroundWorker2 is executed.
Or is both backgroundWorker1 and backgroundWorker2 executed and working simultaniasly ?
What I really are after is to have about 10 loops working simultaniasly so any suggestions for this I will be happy to hear. The only thing that could come up in my mind is that backgroundworkers can be used for this but perheps there could be any other method for this ?
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
backgroundWorker1->RunWorkerAsync();
backgroundWorker2->RunWorkerAsync();
}
private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e)
{
for( int i = 0; i < 1000000; i++ )
{
//Do Stuff
}
}
private: System::Void backgroundWorker2_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e)
{
for( int i = 0; i < 1000000; i++ )
{
//Do Stuff
}
}