{I+=codeWee;}
[C++] Basic of Thread
#include <process.h>
#include <stdio.h>

UINT __stdcall ThreadFunc(void* pParam)
{
	bool isLoop = true;
	int* nResult = (int*)pParam;
	int n = 0;
	while (isLoop)
	{
		if (n > 100)
			_endthreadex(1);
		*nResult += n;
		n++;
	}
	
	return 1;
}

void main()
{

	int nResult = 0;
	HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &ThreadFunc, &nResult, 0, NULL);
	WaitForSingleObject(hThread, INFINITE);
	printf("%d", nResult);
	
	getchar();

}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.