Allow disabling the Debug-mode check in the ABA
This commit is contained in:
committed by
Matthew Parkinson
parent
b598add0d1
commit
dcd47a0449
10
src/ds/aba.h
10
src/ds/aba.h
@@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
namespace snmalloc
|
namespace snmalloc
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#if !defined(NDEBUG) && !defined(SNMALLOC_DISABLE_ABA_VERIFY)
|
||||||
// LL/SC typically can only perform one operation at a time
|
// LL/SC typically can only perform one operation at a time
|
||||||
// check this on other platforms using a thread_local.
|
// check this on other platforms using a thread_local.
|
||||||
inline thread_local bool operation_in_flight = false;
|
inline thread_local bool operation_in_flight = false;
|
||||||
@@ -75,7 +75,7 @@ namespace snmalloc
|
|||||||
|
|
||||||
Cmp read()
|
Cmp read()
|
||||||
{
|
{
|
||||||
# ifndef NDEBUG
|
# if !defined(NDEBUG) && !defined(SNMALLOC_DISABLE_ABA_VERIFY)
|
||||||
if (operation_in_flight)
|
if (operation_in_flight)
|
||||||
error("Only one inflight ABA operation at a time is allowed.");
|
error("Only one inflight ABA operation at a time is allowed.");
|
||||||
operation_in_flight = true;
|
operation_in_flight = true;
|
||||||
@@ -127,7 +127,7 @@ namespace snmalloc
|
|||||||
|
|
||||||
~Cmp()
|
~Cmp()
|
||||||
{
|
{
|
||||||
# ifndef NDEBUG
|
# if !defined(NDEBUG) && !defined(SNMALLOC_DISABLE_ABA_VERIFY)
|
||||||
operation_in_flight = false;
|
operation_in_flight = false;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ namespace snmalloc
|
|||||||
while (lock.test_and_set(std::memory_order_acquire))
|
while (lock.test_and_set(std::memory_order_acquire))
|
||||||
Aal::pause();
|
Aal::pause();
|
||||||
|
|
||||||
# ifndef NDEBUG
|
# if !defined(NDEBUG) && !defined(SNMALLOC_DISABLE_ABA_VERIFY)
|
||||||
if (operation_in_flight)
|
if (operation_in_flight)
|
||||||
error("Only one inflight ABA operation at a time is allowed.");
|
error("Only one inflight ABA operation at a time is allowed.");
|
||||||
operation_in_flight = true;
|
operation_in_flight = true;
|
||||||
@@ -198,7 +198,7 @@ namespace snmalloc
|
|||||||
~Cmp()
|
~Cmp()
|
||||||
{
|
{
|
||||||
parent->lock.clear(std::memory_order_release);
|
parent->lock.clear(std::memory_order_release);
|
||||||
# ifndef NDEBUG
|
# if !defined(NDEBUG) && !defined(SNMALLOC_DISABLE_ABA_VERIFY)
|
||||||
operation_in_flight = false;
|
operation_in_flight = false;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user