This commit is contained in:
greg
2019-03-02 21:54:25 -05:00
parent 2b560f39b2
commit 514e62181d
2 changed files with 11 additions and 7 deletions
+5 -3
View File
@@ -181,16 +181,18 @@ void _fill_random_inner_mt(int64_t cnt, HT &hash, RSU &rsu)
#endif
};
// create and start 8 threads - each will insert in their own submaps
// thread 0 will insert the keys whose hash direct them to submap0 or submap1
// thread 1 will insert the keys whose hash direct them to submap2 or submap3
// --------------------------------------------------------------------------
for (int64_t i=0; i<num_threads; ++i)
{
TD<HT> td {i, num_threads, cnt, hash, rsu};
threads[i].reset(new std::thread(thread_fn, i, rsu));
}
// rsu passed by value to threads... we need to increment the reference object
for (int64_t i=0; i<cnt; ++i)
rsu.next();
// wait for the threads to finish their work and exit
for (int64_t i=0; i<num_threads; ++i)
threads[i]->join();
}