Repository: mesos
Updated Branches:
  refs/heads/master a9dc12d41 -> b930d5ce3


Introduce mutex configure check

* Introduce mutex to the configure check
* Document availability of mutex in style guide

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


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

Branch: refs/heads/master
Commit: 9ce7eca42d778d1399ec6437c9fa33859332f321
Parents: a9dc12d
Author: Joris Van Remoortere <[email protected]>
Authored: Wed Nov 12 11:49:53 2014 -0800
Committer: Dominic Hamon <[email protected]>
Committed: Wed Nov 12 11:50:15 2014 -0800

----------------------------------------------------------------------
 docs/mesos-c++-style-guide.md  |  4 ++++
 m4/ax_cxx_compile_stdcxx_11.m4 | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9ce7eca4/docs/mesos-c++-style-guide.md
----------------------------------------------------------------------
diff --git a/docs/mesos-c++-style-guide.md b/docs/mesos-c++-style-guide.md
index f50354c..dfdde85 100644
--- a/docs/mesos-c++-style-guide.md
+++ b/docs/mesos-c++-style-guide.md
@@ -108,3 +108,7 @@ Try<Owned<LocalAuthorizer>> authorizer = 
LocalAuthorizer::create();
 
 * Rvalue references.
 * Variadic templates.
+* Mutexes.
+    * std::mutex.
+    * std::lock_guard<std::mutex>.
+    * std::unique_lock<std::mutex>.

http://git-wip-us.apache.org/repos/asf/mesos/blob/9ce7eca4/m4/ax_cxx_compile_stdcxx_11.m4
----------------------------------------------------------------------
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
index 72a1080..96f87ea 100644
--- a/m4/ax_cxx_compile_stdcxx_11.m4
+++ b/m4/ax_cxx_compile_stdcxx_11.m4
@@ -37,6 +37,7 @@
 
 m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
   #include <memory>
+  #include <mutex>
 
   template <typename T, typename ...Args>
     struct check
@@ -75,6 +76,22 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
 
     p1->bar();
   }
+
+  void mutexTest()
+  {
+    std::mutex _mutex;
+    {
+      // scope of lockGuard.
+      std::lock_guard<std::mutex> lockGuard(_mutex);
+      // end scope of lockGuard.
+    }
+
+    {
+      // scope of uniqueLock.
+      std::unique_lock<std::mutex> uniqueLock(_mutex);
+      // end scope of uniqueLock.
+    }
+  }
 ])
 
 AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [

Reply via email to