[TSan] Fixed a race
[libcds.git] / test / stress / freelist / put_get.cpp
index 15173a9b7daa5c8e6815a3e1525fb8235361f11a..59f6878a27e4c57d52dbc84297721b6886dc20ed 100644 (file)
@@ -32,7 +32,9 @@
 
 #include <cds/intrusive/free_list.h>
 #include <cds/intrusive/free_list_cached.h>
-#include <cds/intrusive/free_list_tagged.h>
+#ifdef CDS_DCAS_SUPPORT
+#   include <cds/intrusive/free_list_tagged.h>
+#endif
 
 namespace {
     class put_get: public cds_test::stress_fixture
@@ -48,7 +50,7 @@ namespace {
             size_t  counter;
 
             value_type()
-                : counter(0) 
+                : counter(0)
             {}
         };
 
@@ -86,7 +88,9 @@ namespace {
                     item_type* p;
 
                     while ( (p = static_cast<item_type*>( m_FreeList.get())) != nullptr ) {
+                        CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
                         p->counter++;
+                        CDS_TSAN_ANNOTATE_IGNORE_RW_END;
                         arr[n] = p;
                         ++m_nSuccess;
                         ++n;
@@ -173,7 +177,7 @@ namespace {
         };
 
         atomics::atomic<tagged_ptr> tp;
-        if ( tp.is_lock_free() ) {
+        if ( tp.is_lock_free()) {
             cds::intrusive::TaggedFreeList fl;
             test( fl );
         }