Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- DWORD WINAPI myThread(LPVOID x)
- {
- unsigned int& contatore = *((unsigned int*)x);
- while(contatore < 0xFFFFFFFF) ++contatore;
- return 0;
- }
- int main(int argc, char* argv[])
- {
- using namespace std;
- unsigned int contatore = 0;
- DWORD threadID;
- HANDLE myHandle = CreateThread(0, 0, myThread, &contatore, 0, &threadID);
- for(int i=0; i<4; i++) {
- cout << contatore << endl;
- Sleep(200);
- }
- CloseHandle(myHandle);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement