|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82570 - in branches/release/libs/atomic: . doc
From: tim_at_[hidden]
Date: 2013-01-20 13:05:11
Author: timblechmann
Date: 2013-01-20 13:05:10 EST (Sun, 20 Jan 2013)
New Revision: 82570
URL: http://svn.boost.org/trac/boost/changeset/82570
Log:
atomic: merge documentation fix from trunk
Properties modified:
branches/release/libs/atomic/ (props changed)
Text files modified:
branches/release/libs/atomic/doc/examples.qbk | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
Modified: branches/release/libs/atomic/doc/examples.qbk
==============================================================================
--- branches/release/libs/atomic/doc/examples.qbk (original)
+++ branches/release/libs/atomic/doc/examples.qbk 2013-01-20 13:05:10 EST (Sun, 20 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