Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82361 - trunk/libs/atomic/doc
From: tim_at_[hidden]
Date: 2013-01-05 09:54:41


Author: timblechmann
Date: 2013-01-05 09:54:40 EST (Sat, 05 Jan 2013)
New Revision: 82361
URL: http://svn.boost.org/trac/boost/changeset/82361

Log:
atomic: fix example code

patch by gregor jasny
Text files modified:
   trunk/libs/atomic/doc/examples.qbk | 20 ++++++++++----------
   1 files changed, 10 insertions(+), 10 deletions(-)

Modified: trunk/libs/atomic/doc/examples.qbk
==============================================================================
--- trunk/libs/atomic/doc/examples.qbk (original)
+++ trunk/libs/atomic/doc/examples.qbk 2013-01-05 09:54:40 EST (Sat, 05 Jan 2013)
@@ -95,13 +95,13 @@
   public:
     spinlock() : state_(Unlocked) {}
 
- lock()
+ void lock()
     {
       while (state_.exchange(Locked, boost::memory_order_acquire) == Locked) {
         /* busy-wait */
       }
     }
- unlock()
+ void unlock()
     {
       state_.store(Unlocked, boost::memory_order_release);
     }
@@ -186,7 +186,7 @@
   private:
     static boost::atomic<X *> instance_;
     static boost::mutex instantiation_mutex;
- }
+ };
 
   boost::atomic<X *> X::instance_(0);
 
@@ -255,7 +255,7 @@
       if (tail == head_.load(boost::memory_order_acquire))
         return false;
       value = ring_[tail];
- tail_.store(next(tail), boost::memory_order_release));
+ tail_.store(next(tail), boost::memory_order_release);
       return true;
     }
   private:
@@ -265,7 +265,7 @@
     }
     T ring_[Size];
     boost::atomic<size_t> head_, tail_;
- }
+ };
 
 [endsect]
 
@@ -321,15 +321,15 @@
     struct node {
       T data;
       node * next;
- }
+ };
     void push(const T &data)
     {
       node * n = new node;
- n.data = data;
+ n->data = data;
       node * stale_head = head_.load(boost::memory_order_relaxed);
       do {
- node->next = stale_head;
- } while (!head_.compare_exchange_weak(stale_head, node, boost::memory_order_release);
+ n->next = stale_head;
+ } while (!head_.compare_exchange_weak(stale_head, n, boost::memory_order_release));
     }
 
     node * pop_all(void)
@@ -353,7 +353,7 @@
     }
   private:
     boost::atomic<node *> head_;
- }
+ };
 
 [endsect]
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk