123456789101112131415161718192021222324252627282930313233
#include <cstdlib> #include <thread> #include <windows.h> #include <iostream> const int MAX_INDEX = 2; HANDLE hThread[MAX_INDEX]; DWORD dwThread[MAX_INDEX]; using namespace std; void testfunc(){ cout << "Do something" << endl; }; int main(int argc, char** argv) { for(int i = 0; i < MAX_INDEX; i++){ hThread[i] = CreateThread (NULL, 0, testfunc(), (***) NULL, 0, &dwThread[i] ); }; return 0; }