多核编程与并行计算
实验三
// exa3.cpp : Defines the entry point for the console application. //
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
int globalvar = false;
DWORD WINAPI ThreadFunc(LPVOID pParam)
{
}
int main()
{
}
HANDLE hthread = CreateThread(NULL, 0, ThreadFunc, NULL, 0, NULL); if (!hthread) { } while (!globalvar) cout<<"Thread while"<<endl; cout<<"Thread exit"<<endl; return 0; cout<<"Thread Create Error ! "<<endl; CloseHandle(hthread); cout<<"ThreadFunc"<<endl; Sleep(200); globalvar = true; return 0;