Hi,
When I use MVC++ compiler running normally, using Intel c++ compiler the loop execution out-of-order(thread = 1).
The following code:
mNumberOfWorkers=1;
HANDLE *flag = new HANDLE[mNumberOfWorkers];
InitializeCriticalSection(&mcsOS);
for(int i=0; i<mNumberOfWorkers; i++)
{
flag[i]=(HANDLE)_beginthreadex(0,0,(unsigned int(__stdcall*)(void*))OSGeoWorker,this,0,0);
}
WaitForMultipleObjects(mNumberOfWorkers, flag, true, INFINITE);
for (int h = 0; h < mNumberOfWorkers; h++)
{
CloseHandle(flag[h]);
}
delete[] flag;
DeleteCriticalSection(&mcsOS);
for (int i=0, imax=Size; i<imax; i++)
{
image[i]=0.0f;
}
The above function OSGeoWorker is not over, When the program execution to image[i]=0.
The function OSGeoWorker and loop(for (int i=0, imax=Size; i<imax; i++)) run alternately.
how can I find the error in the program?
Thank you !