Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // HelloWorldPRIR.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <Windows.h>
- #include <iostream>
- using namespace std;
- DWORD WINAPI watek(LPVOID lpParam);
- int main()
- {
- DWORD w_id[10];
- HANDLE w_h[10];
- for(int i = 0; i < 10; i++)
- if ((w_h[i] = CreateThread(NULL, 0, watek, (LPVOID)i, 0, &w_id[i])) == NULL)
- {
- cout << "Blad w czasie tworzenia watku nr " << i << endl;
- return 1;
- }
- else
- {
- cout << "Utworzono watek o id = " << w_id[i] << endl;
- }
- WaitForMultipleObjects(10, w_h, TRUE, INFINITE);
- for (int i = 0; i < 10; i++)
- CloseHandle(w_h[i]);
- cin.get();
- return 0;
- }
- DWORD WINAPI watek(LPVOID lpParam) {
- cin.get();
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement