mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 03:47:16 +02:00
fine-tuned memory order for metadata manipulation
This commit is contained in:
@ -206,8 +206,8 @@ template<typename Integral>
|
|||||||
struct atomic_integral
|
struct atomic_integral
|
||||||
{
|
{
|
||||||
#if defined(BOOST_UNORDERED_LATCH_FREE)
|
#if defined(BOOST_UNORDERED_LATCH_FREE)
|
||||||
operator Integral()const{return n.load();}
|
operator Integral()const{return n.load(std::memory_order_acquire);}
|
||||||
void operator=(Integral m){n.store(m);}
|
void operator=(Integral m){n.store(m,std::memory_order_release);}
|
||||||
void operator|=(Integral m){n.fetch_or(m);}
|
void operator|=(Integral m){n.fetch_or(m);}
|
||||||
void operator&=(Integral m){n.fetch_and(m);}
|
void operator&=(Integral m){n.fetch_and(m);}
|
||||||
|
|
||||||
@ -1564,6 +1564,8 @@ private:
|
|||||||
goto startover;
|
goto startover;
|
||||||
}
|
}
|
||||||
auto lck=access(group_exclusive{},pos0);
|
auto lck=access(group_exclusive{},pos0);
|
||||||
|
reinterpret_cast<std::atomic<unsigned char>*>(pg)[n].
|
||||||
|
load(std::memory_order_acquire);
|
||||||
if(BOOST_UNLIKELY(insert_counter(pos0)!=counter)){
|
if(BOOST_UNLIKELY(insert_counter(pos0)!=counter)){
|
||||||
/* other thread inserted from pos0, need to start over */
|
/* other thread inserted from pos0, need to start over */
|
||||||
pg->reset(n);
|
pg->reset(n);
|
||||||
|
Reference in New Issue
Block a user