mesos: Update style guide for usage of std::atomic.

mesos: Update style guide for usage of std::atomic.

Review: https://reviews.apache.org/r/38265


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/94117491
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/94117491
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/94117491

Branch: refs/heads/master
Commit: 941174914d309477b05865078ecf8a0f69db04f8
Parents: 81efd72
Author: Neil Conway <[email protected]>
Authored: Thu Sep 10 17:50:04 2015 -0700
Committer: Joris Van Remoortere <[email protected]>
Committed: Thu Sep 10 19:39:41 2015 -0700

----------------------------------------------------------------------
 docs/mesos-c++-style-guide.md | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/94117491/docs/mesos-c++-style-guide.md
----------------------------------------------------------------------
diff --git a/docs/mesos-c++-style-guide.md b/docs/mesos-c++-style-guide.md
index 5e4d13e..f1ed32a 100644
--- a/docs/mesos-c++-style-guide.md
+++ b/docs/mesos-c++-style-guide.md
@@ -259,6 +259,9 @@ Try<Owned<LocalAuthorizer>> authorizer = 
LocalAuthorizer::create();
   * `std::mutex`
   * `std::lock_guard<std::mutex>`
   * `std::unique_lock<std::mutex>`
+* Atomics (`std::atomic`)
+  * The standard defines a number of predefined typedefs for atomic types 
(e.g., `std::atomic_int`), in addition to `std::atomic<T>`. When a typedef is 
available, it should be preferred over explicit template specialization of 
`std::atomic<T>`.
+  * When reading from and writing to atomic values, the `load` and `store` 
member functions should be used instead of the overloads of `operator T()` and 
`operator=`. Being explicit helps to draw the reader's attention to the fact 
that atomic values are being manipulated.
 * Shared from this.
   * `class T : public std::enable_shared_from_this<T>`
   * `shared_from_this()`

Reply via email to