MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / test_mt_shutdown

Function test_mt_shutdown

3rd/mimalloc-2.0.9/test/main-override.cpp:258–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258static void test_mt_shutdown()
259{
260 const int threads = 5;
261 std::vector< std::future< std::vector< char* > > > ts;
262
263 auto fn = [&]()
264 {
265 std::vector< char* > ps;
266 ps.reserve(1000);
267 for (int i = 0; i < 1000; i++)
268 ps.emplace_back(new char[1]);
269 return ps;
270 };
271
272 for (int i = 0; i < threads; i++)
273 ts.emplace_back(std::async(std::launch::async, fn));
274
275 for (auto& f : ts)
276 for (auto& p : f.get())
277 delete[] p;
278
279 std::cout << "done" << std::endl;
280}
281
282// issue #363
283using namespace std;

Callers 1

mainFunction · 0.85

Calls 2

reserveMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected