simplified erasure

This commit is contained in:
joaquintides
2023-12-18 13:25:14 +01:00
parent 35138450c8
commit b55a13c6b6

View File

@@ -877,14 +877,12 @@ public:
[&,this](group_type* pg,unsigned int n,element_type* p) [&,this](group_type* pg,unsigned int n,element_type* p)
{ {
if(f(cast_for(group_shared{},type_policy::value_from(*p)))){ if(f(cast_for(group_shared{},type_policy::value_from(*p)))){
auto expected=group_type::reduced_hash(hash); // TODO: prove no ABA // TODO: prove no ABA
auto pc=reinterpret_cast<unsigned char*>(pg)+n; auto pc=reinterpret_cast<unsigned char*>(pg)+n;
auto mco=group_type::maybe_caused_overflow(pc); auto mco=group_type::maybe_caused_overflow(pc);
if(reinterpret_cast<std::atomic<unsigned char>*>(pg)[n]. if(reinterpret_cast<std::atomic<unsigned char>*>(pc)->exchange(1)!=1){
compare_exchange_strong(expected,1)){ retire_element(
//super::destroy_element(p); static_cast<std::size_t>(p-this->arrays.elements()),mco);
//pg->reset(n);
retire_element(static_cast<std::size_t>(p-this->arrays.elements()),mco);
res=1; res=1;
} }
} }
@@ -1941,7 +1939,6 @@ private:
{ {
static constexpr std::size_t N=128; static constexpr std::size_t N=128;
static constexpr std::size_t min_for_epoch_bump=64; static constexpr std::size_t min_for_epoch_bump=64;
static constexpr std::size_t min_for_garbage_collection=64;
using ssize_t=std::make_signed<std::size_t>::type; using ssize_t=std::make_signed<std::size_t>::type;