Repository: geode-native
Updated Branches:
  refs/heads/feature/GEODE-2602 [created] c79cb05b0


GEODE-2494: Replace SpinLock with spinlock_mutex.

- Cleanup C++ standards.


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

Branch: refs/heads/feature/GEODE-2602
Commit: bc305ef842c872642601184867f70e957394abfb
Parents: a20a8b0
Author: Jacob Barrett <jbarr...@pivotal.io>
Authored: Tue Feb 21 22:00:21 2017 -0800
Committer: Jacob Barrett <jbarr...@pivotal.io>
Committed: Mon Mar 6 17:32:10 2017 -0800

----------------------------------------------------------------------
 src/cppcache/src/PooledBasePool.hpp | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc305ef8/src/cppcache/src/PooledBasePool.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBasePool.hpp 
b/src/cppcache/src/PooledBasePool.hpp
index f065cb1..2e5cc23 100644
--- a/src/cppcache/src/PooledBasePool.hpp
+++ b/src/cppcache/src/PooledBasePool.hpp
@@ -22,23 +22,27 @@
 
 #include <geode/geode_globals.hpp>
 #include <geode/SharedPtr.hpp>
-#include "SpinLock.hpp"
 #include "PooledBase.hpp"
 #include <deque>
 
+#include <mutex>
+#include "util/concurrent/spinlock_mutex.hpp"
+
 namespace apache {
 namespace geode {
 namespace client {
 
+using util::concurrent::spinlock_mutex;
+
 class CPPCACHE_EXPORT PooledBasePool {
-  SpinLock m_poolLock;
+  spinlock_mutex m_poolLock;
   std::deque<PooledBase*> m_pooldata;
 
  public:
   PooledBasePool() : m_poolLock(), m_pooldata() {}
 
   ~PooledBasePool() {
-    SpinLockGuard guard(m_poolLock);
+    std::lock_guard<spinlock_mutex> guard(m_poolLock);
     while (!m_pooldata.empty()) {
       PooledBase* item = m_pooldata.front();
       m_pooldata.pop_front();
@@ -49,28 +53,28 @@ class CPPCACHE_EXPORT PooledBasePool {
   inline void returnToPool(PooledBase* poolable) {
     poolable->prePool();
     {
-      SpinLockGuard guard(m_poolLock);
+      std::lock_guard<spinlock_mutex> guard(m_poolLock);
       m_pooldata.push_back(const_cast<PooledBase*>(poolable));
     }
   }
 
   inline PooledBase* takeFromPool() {
-    PooledBase* result = NULL;
+    PooledBase* result = nullptr;
     {
-      SpinLockGuard guard(m_poolLock);
+      std::lock_guard<spinlock_mutex> guard(m_poolLock);
       if (!m_pooldata.empty()) {
         result = m_pooldata.front();
         m_pooldata.pop_front();
       }
     }
-    if (result != NULL) {
+    if (result != nullptr) {
       result->postPool();
     }
     return result;
   }
 
   inline void clear() {
-    SpinLockGuard guard(m_poolLock);
+    std::lock_guard<spinlock_mutex> guard(m_poolLock);
     while (!m_pooldata.empty()) {
       PooledBase* item = m_pooldata.front();
       m_pooldata.pop_front();

Reply via email to