diff --git a/MexFunc/RandSim.cpp b/MexFunc/RandSim.cpp index 7391229..f640a9d 100644 --- a/MexFunc/RandSim.cpp +++ b/MexFunc/RandSim.cpp @@ -240,8 +240,8 @@ void ThreadRandSim(TPRandSim& param) { 输出: vr 应该是相关性数值 */ -void mexFunction(int nlhs, mxArray* plhs[], int nrhs, mxArray** prhs) { -//void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { +//void mexFunction(int nlhs, mxArray* plhs[], int nrhs, mxArray** prhs) { +void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { if (nrhs < 1) { cout << "At least 3 arguments should be given for this function!" << endl; return; @@ -326,14 +326,14 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, mxArray** prhs) { } } - //ThreadPool thPool(numThread); + ThreadPool thPool(numThread); int tid = 0; for (int i = 0; i < loopNum; ++i) { TPRandSim tParam = { &vvZr[i], &vvRandPos[tid++ % numThread], &umWordPos, &vvWd2, vvWd.size()}; - //thPool.enqueue(ThreadRandSim, tParam); - ThreadRandSim(tParam); + thPool.enqueue(ThreadRandSim, tParam); + //ThreadRandSim(tParam); } - //thPool.~ThreadPool(); + thPool.~ThreadPool(); finish = clock(); cout << "Random simulation time: " << (double)(finish - mid) / CLOCKS_PER_SEC << " s" << endl;