]> AND Private Git Repository - loba.git/blobdiff - sync_queue.h
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Fix missing definition in gcc 4.4/cstdatomic.
[loba.git] / sync_queue.h
index 888854871e408697737566eb3d7d16ce04e5de43..c2b24c3cedace563be069e22bdd752b0296d6252 100644 (file)
@@ -3,6 +3,12 @@
 
 #if __GNUC__ == 4 && __GNUC_MINOR__ == 4
 #  include <cstdatomic>         // <atomic> is named <cstdatomic> in gcc 4.4
 
 #if __GNUC__ == 4 && __GNUC_MINOR__ == 4
 #  include <cstdatomic>         // <atomic> is named <cstdatomic> in gcc 4.4
+
+template<typename _Tp>          // fix missing definition in gcc 4.4
+void
+atomic<_Tp*>::store(_Tp* __v, memory_order __m) volatile
+{ atomic_address::store(__v, __m); }
+
 #else
 #  include <atomic>
 #endif
 #else
 #  include <atomic>
 #endif
@@ -13,8 +19,8 @@ public:
     sync_queue()
     {
         node* n = new node(NULL, NULL);
     sync_queue()
     {
         node* n = new node(NULL, NULL);
-        std::atomic_store(&head, n); // head.store(n);
-        std::atomic_store(&tail, n); // tail.store(n);
+        head.store(n);
+        tail.store(n);
     }
 
     ~sync_queue()
     }
 
     ~sync_queue()
@@ -46,7 +52,7 @@ public:
         node* old_tail = tail.load();
         node* n = new node(val, NULL);
         old_tail->next = n;
         node* old_tail = tail.load();
         node* n = new node(val, NULL);
         old_tail->next = n;
-        std::atomic_store(&tail, n); // tail.store(n);
+        tail.store(n);
         return (old_tail == head.load());
     }
 
         return (old_tail == head.load());
     }
 
@@ -57,7 +63,7 @@ public:
             return false;
         } else {
             node* new_head = old_head->next;
             return false;
         } else {
             node* new_head = old_head->next;
-            std::atomic_store(&head, new_head); // head.store(new_head);
+            head.store(new_head);
             delete old_head;
             res = new_head->value;
             return true;
             delete old_head;
             res = new_head->value;
             return true;