CreateThread Документация - https://docs.microsoft.com/en-us/wi...sthreadsapi/nf-processthreadsapi-createthread
#include <thread> #include <iostream> #include <vector> using namespace std; void doSomething(int id) { // cout << id << "\n"; printf("[!] Count: %X\n", id); } void spawnThreads(int n) { std::vector<thread> threads(n); for (int i = 0; i < n; i++) { threads[i] = thread(doSomething, i + 1); } for (auto& th : threads) { th.join(); } } int main() { spawnThreads(2); return getchar(); return 0; } Код #include <thread> #include <iostream> #include <vector> using namespace std; void doSomething(int id) { // cout << id << "\n"; printf("[!] Count: %X\n", id); } void spawnThreads(int n) { std::vector<thread> threads(n); for (int i = 0; i < n; i++) { threads[i] = thread(doSomething, i + 1); } for (auto& th : threads) { th.join(); } } int main() { spawnThreads(2); return getchar(); return 0; }