在循环和wait语句中创建窗口上的线程数组

时间:2015-05-05 02:43:19

标签: multithreading

这是对的吗?我想创建执行startHelper函数的stageList.size()线程,但我不知道如何在窗口上创建Linux waitid()

HANDLE *threads =  new HANDLE[stageList.size()];
DWORD *thId =  new DWORD[stageList.size()];
  for (int i = 0; i < stageList.size(); i++) {
       threads[i]=CreateThread(NULL, 0, startHelper, (LPVOID) stageList.at(i),0,&thId[i]);
      if ( threads[i]== NULL) {
      printf("CreateThread failed: %d\n",GetLastError());
    }
  }

1 个答案:

答案 0 :(得分:2)

试试这个

WaitForMultipleObjects(stageList.size(),threads,true,INFINITE);