用C创建一个新线程

#include <stdio.h>
#include <windows.h>

DWORD WINAPI FunProc(LPVOID lpParameter);

int main() {
	HANDLE hThread1;
	hThread1 = CreateThread(NULL, 0, FunProc, NULL, 0, NULL);
	CloseHandle(hThread1);
	printf("main thread is running...\r\n");
	getchar();
}

// 线程入口函数
DWORD WINAPI FunProc(LPVOID lpParameter) {
	printf("thread1 is running...\r\n");
	return 0;
}

你可能感兴趣的:(thread,C++,c,C#)