多核编程与并行计算
DWORD ThreadProc2(void * pData) {
}
int main(int argc, char* argv[]) {
h2= CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) ThreadProc2, (void *)&ID2, 0, &(ID2)); int i; DWORD ID1,ID2; InitializeCriticalSection(&cs); printf("Create the critical section \n"); h1 = CreateThread(NULL, printf("CreateThread error %d \n",ID1); printf("CreateThread %d \n",ID1); 0, (LPTHREAD_START_ROUTINE) ThreadProc1, (void *)&ID1, 0, &(ID1)); return 0; EnterCriticalSection(&cs); printf("ThreadProc2 %d enters into critical section\n",ThreadNumberTemp); Sleep(1000); LeaveCriticalSection(&cs); int ThreadNumberTemp = (*(int*) pData); printf("ThreadProc2: %d is running!\n",ThreadNumberTemp ); HANDLE h1,h2; if (h1 == NULL) else