I am trying to call the "Run" function in a new thread. Right now, I have this code using openMP that doesn't actually run "Run" in a new thread. NOTE: I am not asking for help using OpenMP. This code was just a quick fix. I would prefer a CreateThread() method of going about this.
vector<ICommand*>* commands;
string strInput;
// For each command...
for(vector<ICommand*>::iterator i = commands->begin(); i != commands->end(); ++i)
{
// ...if the current command we're examining is valid...
if((*i)->ContainsCommand(strInput))
{
// ...run it in a new thread and don't let ZChatInput handle it normally...
#pragma omp sections nowait
{
#pragma omp section
(*i)->Run(strInput);
#pragma omp section
bRet = false;
}
// ...and don't check any more commands.
break;
}
}
So how would this be done using just standard and STL? Of course, I'm looking for a way that works :)