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 <[email protected]> Authored: Sat Jun 13 06:10:49 2015 -0700 Committer: Benjamin Hindman <[email protected]> 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.
