#include <iostream>
#include <thread>
#include <windows.h>
#include <vector>
using namespace std;
using namespace std::this_thread;
void msg()
{
MessageBoxA(0, "12345", "678910", 0);
}
void main()
{
vector<thread *> threads;
for (int i = 0; i < 10;i++)
{
threads.push_back(new thread(msg));//创建一个线程
}
for (auto th: threads)
{
th->join();
}
system("pause");
}
#include <thread>
#include <windows.h>
#include <vector>
using namespace std;
using namespace std::this_thread;
void msg()
{
MessageBoxA(0, "12345", "678910", 0);
}
void main()
{
vector<thread *> threads;
for (int i = 0; i < 10;i++)
{
threads.push_back(new thread(msg));//创建一个线程
}
for (auto th: threads)
{
th->join();
}
system("pause");
}