made concurrent_table::thread_counter static

This commit is contained in:
joaquintides
2023-03-29 16:45:15 +02:00
parent 7b1af37b9c
commit 4482031329

View File

@ -656,7 +656,6 @@ private:
shared_lock_guard shared_access()const
{
// TODO: make this more sophisticated (even distribution)
thread_local auto id=(++thread_counter)%mutexes.size();
return shared_lock_guard{mutexes[id]};
@ -1051,11 +1050,13 @@ private:
}
#endif
/* TODO: thread_counter should be static */
mutable std::atomic<unsigned int> thread_counter{0};
mutable multimutex_type mutexes;
static std::atomic<std::size_t> thread_counter;
mutable multimutex_type mutexes;
};
template<typename T,typename H,typename P,typename A>
std::atomic<std::size_t> concurrent_table<T,H,P,A>::thread_counter=0;
#if defined(BOOST_MSVC)
#pragma warning(pop) /* C4714 */
#endif