BorderGame

Versione completa: [C++] Multithreading
Al momento stai visualizzando i contenuti in una versione ridotta. Visualizza la versione completa e formattata.
Ecco a voi

#include <windows.h>
#include <iostream>

HANDLE thread1, thread2;
DWORD thrdid;

DWORD WINAPI thr1(LPVOID param)
{
while(1) std::cout << "thread 1" << std::endl;
}

DWORD WINAPI thr2(LPVOID param)
{
while(1) std::cout << "thread 2" << std::endl;
}

int main()
{
thread1 = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)thr1,0,0,&thrdid);
thread2 = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)thr2,0,0,&thrdid);

system("pause");
return 0;
}

Per chi non sa cos'è il multithreading esiste wikipedia ^^ http://it.wikipedia.org/wiki/Multithreading
URL di riferimento