mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 03:47:16 +02:00
made concurrent_table::thread_counter static
This commit is contained in:
@ -656,7 +656,6 @@ private:
|
|||||||
|
|
||||||
shared_lock_guard shared_access()const
|
shared_lock_guard shared_access()const
|
||||||
{
|
{
|
||||||
// TODO: make this more sophisticated (even distribution)
|
|
||||||
thread_local auto id=(++thread_counter)%mutexes.size();
|
thread_local auto id=(++thread_counter)%mutexes.size();
|
||||||
|
|
||||||
return shared_lock_guard{mutexes[id]};
|
return shared_lock_guard{mutexes[id]};
|
||||||
@ -1051,11 +1050,13 @@ private:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TODO: thread_counter should be static */
|
static std::atomic<std::size_t> thread_counter;
|
||||||
mutable std::atomic<unsigned int> thread_counter{0};
|
|
||||||
mutable multimutex_type mutexes;
|
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)
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(pop) /* C4714 */
|
#pragma warning(pop) /* C4714 */
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user