#include <vector> #include <iostream> #include <thread> #include <windows.h> using namespace std; void test(int a,int b) { for (size_t i = 0; i < 5; i++) { cout << a <<" "<<b << endl; Sleep(100); } } int main(int argc, char* argv[]) { vector<thread> vT; for (size_t i = 0; i < 10; i++) vT.push_back(thread(test, i,i+100)); for (size_t i = 0; i < 10; i++) vT[i].join(); system("pause"); return 0; }
c++11多线程
猜你喜欢
转载自www.cnblogs.com/tiandsp/p/9059558.html
今日推荐
周排行