
92 High Performance Programming for Soft Computing
Result[1]+=(Data1[i]* Data2[i]);
}
}
// Set the thread finished variables
if(ThreadID[0]==1){ WaitForThread1 =0;}
if(ThreadID[0]==2){ WaitForThread2 =0;}
// explicit end thread, helps to ensure proper recovery of resources allocated for the thread
_endthreadex(0);
return0;
}
// The matlab mex function
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs,const mxArray *prhs[])
{
double*Data1;// The input data
double*Data2;// The input data
double*Result;// The output data
mwSize Dcols, Drows; // Dimensions of input data
double**ThreadArgs1,**ThreadArgs2;// double pointer array to store all needed function ...