Replace std::lock_guard with synchronized in fetcher_cache_test.

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


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

Branch: refs/heads/master
Commit: 9e7f64a8c5c2d12fb6ca5366aec2ebc826ad8fa1
Parents: eb8f88d
Author: Joris Van Remoortere <[email protected]>
Authored: Sat Jun 13 05:55:56 2015 -0700
Committer: Benjamin Hindman <[email protected]>
Committed: Sun Jun 14 02:43:00 2015 -0700

----------------------------------------------------------------------
 src/tests/fetcher_cache_tests.cpp | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9e7f64a8/src/tests/fetcher_cache_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fetcher_cache_tests.cpp 
b/src/tests/fetcher_cache_tests.cpp
index d6d768d..8bd5dd8 100644
--- a/src/tests/fetcher_cache_tests.cpp
+++ b/src/tests/fetcher_cache_tests.cpp
@@ -44,8 +44,6 @@
 #include <stout/os.hpp>
 #include <stout/try.hpp>
 
-#include "common/lock.hpp"
-
 #include "master/flags.hpp"
 #include "master/master.hpp"
 
@@ -767,19 +765,19 @@ public:
       // this function via a Queue. This is currently non-trivial
       // because we can't copy an HttpEvent so we're _forced_ to block
       // the thread synchronously.
-      std::lock_guard<std::mutex> lock(mutex);
+      synchronized (mutex) {
+        countRequests++;
 
-      countRequests++;
+        if (strings::contains(event.request->path, COMMAND_NAME)) {
+          countCommandRequests++;
+        }
 
-      if (strings::contains(event.request->path, COMMAND_NAME)) {
-        countCommandRequests++;
-      }
+        if (strings::contains(event.request->path, ARCHIVE_NAME)) {
+          countArchiveRequests++;
+        }
 
-      if (strings::contains(event.request->path, ARCHIVE_NAME)) {
-        countArchiveRequests++;
+        ProcessBase::visit(event);
       }
-
-      ProcessBase::visit(event);
     }
 
     void resetCounts()

Reply via email to