mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 16:40:39 +08:00
wip
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user