You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/06/14 11:46:25 UTC

[07/21] mesos git commit: Rebase master_contender_detector_tests with synchronized.

Rebase master_contender_detector_tests with synchronized.

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


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

Branch: refs/heads/master
Commit: dc17126a46f2e0db17ccdf84ce0d65683d7929a5
Parents: e1a13ad
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Sat Jun 13 06:10:49 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Jun 14 02:43:00 2015 -0700

----------------------------------------------------------------------
 src/tests/master_contender_detector_tests.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dc17126a/src/tests/master_contender_detector_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_contender_detector_tests.cpp b/src/tests/master_contender_detector_tests.cpp
index af6f15a..1b30eeb 100644
--- a/src/tests/master_contender_detector_tests.cpp
+++ b/src/tests/master_contender_detector_tests.cpp
@@ -282,14 +282,16 @@ TEST_F(ZooKeeperMasterContenderDetectorTest, ContenderPendingElection)
 
   process::TestsFilter* filter =
     process::FilterTestEventListener::instance()->install();
-  pthread_mutex_lock(&filter->mutex);
-
-  // Expect GroupProcess::join not getting called because
-  // ZooKeeperMasterContender directly returns.
-  EXPECT_CALL(filter->mock, filter(testing::A<const process::DispatchEvent&>()))
-    .With(DispatchMatcher(_, &GroupProcess::join))
-    .Times(0);
-  pthread_mutex_unlock(&filter->mutex);
+
+  synchronized (filter->mutex) {
+    // Expect GroupProcess::join not getting called because
+    // ZooKeeperMasterContender directly returns.
+    EXPECT_CALL(
+        filter->mock,
+        filter(testing::A<const process::DispatchEvent&>()))
+      .With(DispatchMatcher(_, &GroupProcess::join))
+      .Times(0);
+  }
 
   // Recontend and settle so that if ZooKeeperMasterContender is not
   // directly returning, GroupProcess::join is dispatched.