Remove src/common/lock. Use synchronized instead.

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


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

Branch: refs/heads/master
Commit: ad378345f7fe12d4c091d46d44f2485b09fba40e
Parents: f4aaa14
Author: Joris Van Remoortere <[email protected]>
Authored: Sat Jun 13 07:24:11 2015 -0700
Committer: Benjamin Hindman <[email protected]>
Committed: Sun Jun 14 02:43:01 2015 -0700

----------------------------------------------------------------------
 src/Makefile.am     |  2 --
 src/common/lock.cpp | 55 ------------------------------------------------
 src/common/lock.hpp | 45 ---------------------------------------
 3 files changed, 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ad378345/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 3c44f01..884533e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -353,7 +353,6 @@ libmesos_no_3rdparty_la_SOURCES =                           
        \
        common/attributes.cpp                                           \
        common/date_utils.cpp                                           \
        common/http.cpp                                                 \
-       common/lock.cpp                                                 \
        common/protobuf_utils.cpp                                       \
        common/resources.cpp                                            \
        common/resources_utils.cpp                                      \
@@ -580,7 +579,6 @@ libmesos_no_3rdparty_la_SOURCES +=                          
        \
        common/date_utils.hpp                                           \
        common/factory.hpp                                              \
        common/http.hpp                                                 \
-       common/lock.hpp                                                 \
        common/parse.hpp                                                \
        common/protobuf_utils.hpp                                       \
        common/resources_utils.hpp                                      \

http://git-wip-us.apache.org/repos/asf/mesos/blob/ad378345/src/common/lock.cpp
----------------------------------------------------------------------
diff --git a/src/common/lock.cpp b/src/common/lock.cpp
deleted file mode 100644
index bb8ea3a..0000000
--- a/src/common/lock.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "lock.hpp"
-
-namespace mesos {
-namespace internal {
-
-Lock::Lock(pthread_mutex_t* _mutex)
-  : mutex(_mutex), locked(false)
-{
-  lock();
-}
-
-
-void Lock::lock()
-{
-  if (!locked) {
-    pthread_mutex_lock(mutex);
-    locked = true;
-  }
-}
-
-
-void Lock::unlock()
-{
-  if (locked) {
-    locked = false;
-    pthread_mutex_unlock(mutex);
-  }
-}
-
-
-Lock::~Lock()
-{
-  unlock();
-}
-
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/ad378345/src/common/lock.hpp
----------------------------------------------------------------------
diff --git a/src/common/lock.hpp b/src/common/lock.hpp
deleted file mode 100644
index 988dff5..0000000
--- a/src/common/lock.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LOCK_HPP__
-#define __LOCK_HPP__
-
-#include <pthread.h>
-
-namespace mesos {
-namespace internal {
-
-// RAII class for locking pthread_mutexes.
-class Lock
-{
-public:
-  explicit Lock(pthread_mutex_t* _mutex);
-  ~Lock();
-
-  void lock();
-  void unlock();
-
-private:
-  pthread_mutex_t* mutex;
-  bool locked;
-};
-
-} // namespace internal {
-} // namespace mesos {
-
-#endif // __LOCK_HPP__

Reply via email to