You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/03/07 01:36:54 UTC

[14/21] geode-native git commit: GEODE-2494: Removed SpinLock.

GEODE-2494: Removed SpinLock.



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

Branch: refs/heads/feature/GEODE-2602
Commit: 80fd387e654b7605f660f0f9e97d0e92865ac19d
Parents: 9a7078b
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Wed Feb 22 21:29:49 2017 -0800
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Mon Mar 6 17:32:11 2017 -0800

----------------------------------------------------------------------
 src/cppcache/integration-test/testSpinLock.cpp |  46 ++--
 src/cppcache/src/CacheImpl.hpp                 |   1 -
 src/cppcache/src/EventId.hpp                   |   1 -
 src/cppcache/src/HostAsm.cpp                   |   2 -
 src/cppcache/src/HostAsm.hpp                   | 252 --------------------
 src/cppcache/src/LocalRegion.hpp               |   1 -
 src/cppcache/src/SpinLock.cpp                  |  37 ---
 src/cppcache/src/SpinLock.hpp                  | 122 ----------
 src/cppcache/src/TcrEndpoint.hpp               |   1 -
 src/cppcache/src/hostsolaris.asm               |  83 -------
 10 files changed, 21 insertions(+), 525 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/integration-test/testSpinLock.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSpinLock.cpp b/src/cppcache/integration-test/testSpinLock.cpp
index cfaa810..7c13441 100644
--- a/src/cppcache/integration-test/testSpinLock.cpp
+++ b/src/cppcache/integration-test/testSpinLock.cpp
@@ -20,28 +20,23 @@
 #include "fw_dunit.hpp"
 #include <geode/GeodeCppCache.hpp>
 
+#include <mutex>
+#include <util/concurrent/spinlock_mutex.hpp>
+
 #include <Condition.hpp>
 
 #include <ace/Task.h>
 #include <ace/Time_Value.h>
 #include <ace/Guard_T.h>
 
-namespace apache {
-namespace geode {
-namespace client {
+namespace {
 
-CPPCACHE_EXPORT void* testSpinLockCreate();
-CPPCACHE_EXPORT void testSpinLockAcquire(void* lock);
-CPPCACHE_EXPORT void testSpinLockRelease(void* lock);
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
+using apache::geode::util::concurrent::spinlock_mutex;
 
 DUNIT_TASK(s1p1, Basic)
   {
-    void* lock = apache::geode::client::testSpinLockCreate();
-    apache::geode::client::testSpinLockAcquire(lock);
-    apache::geode::client::testSpinLockRelease(lock);
+    spinlock_mutex s;
+    { std::lock_guard<spinlock_mutex> lk(s); }
   }
 END_TASK(Basic)
 
@@ -49,7 +44,7 @@ perf::Semaphore* triggerA;
 perf::Semaphore* triggerB;
 perf::Semaphore* triggerM;
 
-void* lock;
+spinlock_mutex lock;
 ACE_Time_Value* btime;
 
 class ThreadA : public ACE_Task_Base {
@@ -57,11 +52,12 @@ class ThreadA : public ACE_Task_Base {
   ThreadA() : ACE_Task_Base() {}
 
   int svc() {
-    apache::geode::client::testSpinLockAcquire(lock);
-    LOG("ThreadA: Acquired lock x.");
-    triggerM->release();
-    triggerA->acquire();
-    apache::geode::client::testSpinLockRelease(lock);
+    {
+      std::lock_guard<spinlock_mutex> lk(lock);
+      LOG("ThreadA: Acquired lock x.");
+      triggerM->release();
+      triggerA->acquire();
+    }
     LOG("ThreadA: Released lock.");
     return 0;
   }
@@ -73,11 +69,12 @@ class ThreadB : public ACE_Task_Base {
 
   int svc() {
     triggerB->acquire();
-    apache::geode::client::testSpinLockAcquire(lock);
-    btime = new ACE_Time_Value(ACE_OS::gettimeofday());
-    LOG("ThreadB: Acquired lock.");
-    triggerM->release();
-    apache::geode::client::testSpinLockRelease(lock);  // for cleanly ness.
+    {
+      std::lock_guard<spinlock_mutex> lk(lock);
+      btime = new ACE_Time_Value(ACE_OS::gettimeofday());
+      LOG("ThreadB: Acquired lock.");
+      triggerM->release();
+    }
     return 0;
   }
 };
@@ -88,8 +85,6 @@ DUNIT_TASK(s1p1, TwoThreads)
     triggerB = new perf::Semaphore(0);
     triggerM = new perf::Semaphore(0);
 
-    lock = apache::geode::client::testSpinLockCreate();
-
     ThreadA* threadA = new ThreadA();
     ThreadB* threadB = new ThreadB();
 
@@ -159,3 +154,4 @@ DUNIT_TASK(s1p1, Cond)
     XASSERT(delta.msec() >= (delay.msec() - 50));
   }
 ENDTASK
+}  // namespace

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/CacheImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheImpl.hpp b/src/cppcache/src/CacheImpl.hpp
index 84dc954..352b79d 100644
--- a/src/cppcache/src/CacheImpl.hpp
+++ b/src/cppcache/src/CacheImpl.hpp
@@ -27,7 +27,6 @@
 #include <geode/CacheAttributes.hpp>
 #include <geode/DistributedSystem.hpp>
 #include "MapWithLock.hpp"
-#include "SpinLock.hpp"
 #include <ace/ACE.h>
 #include <ace/Condition_Recursive_Thread_Mutex.h>
 #include <ace/Time_Value.h>

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/EventId.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EventId.hpp b/src/cppcache/src/EventId.hpp
index 92d17a6..cae6bdd 100644
--- a/src/cppcache/src/EventId.hpp
+++ b/src/cppcache/src/EventId.hpp
@@ -24,7 +24,6 @@
 #include <geode/geode_types.hpp>
 #include <geode/Cacheable.hpp>
 #include "GeodeTypeIdsImpl.hpp"
-#include "SpinLock.hpp"
 #include <geode/DataOutput.hpp>
 
 #include <string>

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/HostAsm.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/HostAsm.cpp b/src/cppcache/src/HostAsm.cpp
index 763256b..6a65249 100644
--- a/src/cppcache/src/HostAsm.cpp
+++ b/src/cppcache/src/HostAsm.cpp
@@ -25,8 +25,6 @@
 
 using namespace apache::geode::client;
 
-int32_t HostAsm::m_SpinCount = 0;
-
 // TODO refactor - why do we have our own atomic methods? why not use C++11?
 
 #if defined(_LINUX) || defined(_X86_SOLARIS)

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/HostAsm.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/HostAsm.hpp b/src/cppcache/src/HostAsm.hpp
index 770cb5d..3fe59a4 100644
--- a/src/cppcache/src/HostAsm.hpp
+++ b/src/cppcache/src/HostAsm.hpp
@@ -55,37 +55,10 @@ namespace apache {
 namespace geode {
 namespace client {
 
-typedef volatile uint32_t SpinLockField;
-
-/* These should be defined the same as their HOST_LOCK counterparts. */
-#if defined(FLG_SOLARIS_UNIX)
-
-// StaticSpinLock assumes that SpinLock values are initialized to zero!
-
-/* no longer using the ldstub instruction, now using cas */
-/*  Use the high order 4 bytes of the word as the lock */
-enum { SPINLOCK_SET_INT = 0xf0000000 };
-enum { SPINLOCK_SET_BYTE = 0xf0 };
-enum { SPINLOCK_CLEAR_INT = 0 };
-enum { SPINLOCK_CLEAR_BYTE = 0 };
-
-#else
-
-// StaticSpinLock assumes that SpinLock values are initialized to zero!
-
-/* default Windows and x86 Linux */
-enum { SPINLOCK_SET_INT = 1 };
-enum { SPINLOCK_SET_BYTE = 1 };
-enum { SPINLOCK_CLEAR_INT = 0 };
-enum { SPINLOCK_CLEAR_BYTE = 0 };
-
-#endif
 
 #ifdef _SPARC_SOLARIS
 // implemented in hostsolaris.asm
 extern "C" {
-void HostAsmUnlock(int32_t, SpinLockField*);
-bool HostAsmTryLock(SpinLockField*, int32_t, uint32_t);
 int32_t InterlockedExchangeAdd(volatile int32_t*, int32_t);
 // int64_t InterlockedExchangeAddLong(volatile int64_t *, int64_t);
 }
@@ -103,136 +76,6 @@ int32_t InterlockedCompareExchange(volatile LONG*, int32_t, int32_t);
  */
 class CPPCACHE_EXPORT HostAsm {
  public:
-  enum HostSleepConsts {
-    SPIN_MIN_SLEEP = 250,
-    SPIN_SLEEP_LIMIT = 5000,
-    SPIN_COUNT = 3000
-  };
-
-  static void spinLockInit(SpinLockField& lockField) {
-    // StaticSpinLock assumes that SpinLock values are initialized to zero!
-    lockField = SPINLOCK_CLEAR_INT;
-  }
-
-  /**
-   *  Get exclusive access to the lock, return when the lock is granted.
-   */
-  inline static void spinLockAcquire(SpinLockField& lockField) {
-#if defined(_MACOSX)
-    OSSpinLockLock(reinterpret_cast<volatile int32_t*>(&lockField));
-#else
-    uint32_t lockVal = SPINLOCK_SET_INT;
-    int32_t spinCount = HostAsm::getSpinCount();
-    if (!HostAsm::_tryLock(lockField, spinCount, lockVal)) {
-      ACE_OS::thr_yield();
-      if (!HostAsm::_tryLock(lockField, spinCount, lockVal)) {
-        uint32_t lock_sleepTime = SPIN_MIN_SLEEP;
-        do {
-          HostAsm::nanoSleep(lock_sleepTime);
-          if (lock_sleepTime < SPIN_SLEEP_LIMIT) {
-            lock_sleepTime++;
-          }
-        } while (!HostAsm::_tryLock(lockField, spinCount, lockVal));
-      }
-    }
-#endif
-  }
-
-  inline static int32_t getCpuCount() {
-#ifdef _WIN32
-    SYSTEM_INFO si;
-    GetSystemInfo(&si);
-    return si.dwNumberOfProcessors;
-#else
-    return static_cast<int32_t>(sysconf(_SC_NPROCESSORS_ONLN));
-#endif
-  }
-
-  inline static void nanoSleep(uint32_t time) {
-    timespec nanos;
-    nanos.tv_sec = 0;
-    nanos.tv_nsec = time;
-    timespec remaining;
-    remaining.tv_sec = 0;
-    remaining.tv_nsec = 0;
-    ACE_OS::nanosleep(&nanos, &remaining);
-  }
-
-  inline static int64_t currentTimeMs() {
-    return ACE_OS::gettimeofday().msec();
-  }
-
-#if 0  // Unused
-    /**
-     * Try to get exclusive access to the lock in the specified amount of time.
-     * Return whether the lock is granted.
-     */
-    inline static bool spinLockTryAcquire(SpinLockField& lockField,
-        int32_t msTimeout)
-    {
-#if defined(_MACOSX)
-      return OSSpinLockTry((volatile int32_t *) &lockField);
-#else
-      uint32_t lockVal = SPINLOCK_SET_INT;
-      int32_t spinCount = HostAsm::getSpinCount();
-      int64_t startTime = HostAsm::currentTimeMs();
-      if (!HostAsm::_tryLock(lockField, spinCount, lockVal)) {
-	      ACE_OS::thr_yield();
-	      if (!HostAsm::_tryLock(lockField, spinCount, lockVal)) {
-	        uint32_t lock_sleepTime = SPIN_MIN_SLEEP;
-	        do {
-	          HostAsm::nanoSleep(lock_sleepTime);
-            if (lock_sleepTime < SPIN_SLEEP_LIMIT) {
-              lock_sleepTime++;
-            }
-            if (HostAsm::currentTimeMs() - startTime > (int64_t)msTimeout) {
-              return false;
-            }
-          } while (!HostAsm::_tryLock(lockField, spinCount, lockVal));
-        }
-      }
-      return true;
-#endif
-    }
-#endif
-
-  /**
-   * Name - SpinUnlock
-   * Purpose -
-   *      Release the specified spinlock.
-   */
-  inline static void spinLockRelease(SpinLockField& lockField) {
-#ifdef _WIN32
-    InterlockedExchange((volatile LONG*)(&lockField), SPINLOCK_CLEAR_BYTE);
-#elif defined(_LINUX) /*|| defined(_X86_SOLARIS)*/
-
-    int oldval = SPINLOCK_CLEAR_BYTE;
-    __asm__ __volatile__("xchg %0, %1"
-                         : "=q"(oldval), "=m"(lockField)
-                         : "0"(oldval)
-                         : "memory");
-#elif defined(_SPARC_SOLARIS)
-    SpinLockField* lockPtr = &lockField;
-    HostAsmUnlock(SPINLOCK_CLEAR_BYTE, lockPtr);
-#elif defined(_X86_SOLARIS)
-    // atomic_cas_32((volatile uin32_t*)&lockField, 1, 0);
-    atomic_cas_32(&lockField, 1, 0);
-#elif defined(_MACOSX)
-    OSSpinLockUnlock(reinterpret_cast<volatile int32_t*>(&lockField));
-#else
-#error Port incomplete.
-#endif
-  }
-
-  static int32_t m_SpinCount;
-
-  inline static int32_t getSpinCount() {
-    if (HostAsm::m_SpinCount == 0) {
-      HostAsm::m_SpinCount =
-          (HostAsm::getCpuCount() == 1 ? 1 : int32_t(SPIN_COUNT));
-    }
-    return HostAsm::m_SpinCount;
-  }
 
 #if defined(_LINUX) || defined(_X86_SOLARIS)
   inline static int32_t InterlockedExchangeAdd(volatile int32_t* val,
@@ -342,101 +185,6 @@ class CPPCACHE_EXPORT HostAsm {
     return atomicAnd(data, ~mask);
   }
 
- private:
-#if !defined(_MACOSX)
-  inline static bool _tryLock(SpinLockField& lockField, int32_t count,
-                              uint32_t lockVal) {
-    GF_DEV_ASSERT(count > 0);
-#if defined(_LINUX)
-    int oldval = 1;  // Set to 1, since we use 0 as success.
-    do {
-      oldval = 1;
-      __asm__ __volatile__(
-          "lock\n"
-          "xchg %0,%1"
-          : "=q"(oldval), "=m"(lockField)
-          : "0"(SPINLOCK_SET_BYTE)
-          : "memory");
-      if (oldval == 0) {
-        return true;
-      }
-      __asm__ __volatile__("pause");
-      count--;
-    } while (count > 0);
-    if (oldval == 0) {
-      return true;
-    }
-    return false;
-#elif defined(_SPARC_SOLARIS)
-    SpinLockField* lockPtr = &lockField;
-    return HostAsmTryLock(lockPtr, count, lockVal);
-#elif defined(_X86_SOLARIS)
-    SpinLockField* lockPtr = &lockField;
-    do {
-      if (*lockPtr == SPINLOCK_CLEAR_INT) {
-        // if oldValue is zero, then it must have been updated to 1
-        // else if CAS was unsuccessful then it will still be locked i.e. 1
-        if (atomic_cas_32(lockPtr, 0, 1) == 0) {
-          return true;
-        }
-      }
-      // yield the thread if required to avoid tight spin
-      ACE_Thread::yield();
-      count--;
-    } while (count > 0);
-    return false;
-#elif defined(_WIN32)
-    SpinLockField* lockPtr = &lockField;
-    SpinLockField prevValue;
-    // SpinLockField prevCopy;
-    prevValue = *lockPtr;
-    do {
-      if (prevValue == SPINLOCK_CLEAR_INT) {
-        if (InterlockedCompareExchangeAcquire((volatile LONG*)lockPtr, lockVal,
-                                              SPINLOCK_CLEAR_INT) ==
-            SPINLOCK_CLEAR_INT) {
-          return true;
-        }
-      } else {
-#if defined(_MANAGED)
-        Sleep(0);
-#else
-        YieldProcessor();
-        YieldProcessor();
-        YieldProcessor();
-        YieldProcessor();
-        YieldProcessor();
-#endif
-      }
-      // Fancy atomic read, equivalent to prevValue = *lockPtr
-      prevValue = InterlockedExchangeAdd((volatile LONG*)(lockPtr), 0);
-    } while (--count >= 0);
-    return false;
-/*
-if(count--) {
-  return false;
-}
-prevCopy = prevValue;
-if(prevValue == SPINLOCK_CLEAR_INT) {
-  prevValue = InterlockedCompareExchangeAcquire(
-    (volatile LONG*)lockPtr, lockVal, prevValue);
-} else {
-  //Fancy atomic read, equivalent to prevValue = *lockPtr
-  prevValue = InterlockedExchangeAdd((volatile LONG*)(lockPtr), 0);
-
-  //This might be slightly faster
-  //prevValue = InterlockedCompareExchange((volatile LONG*)lockPtr,
-  //                                       prevValue, prevValue);
-}
-} while( prevCopy != prevValue );
-return true;
-*/
-#else
-#error Port impcomplete
-#endif
-    return true;
-  }
-#endif  // !defined(_MACOSX)
 };
 }  // namespace client
 }  // namespace geode

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/LocalRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LocalRegion.hpp b/src/cppcache/src/LocalRegion.hpp
index 0d0fa58..0998228 100644
--- a/src/cppcache/src/LocalRegion.hpp
+++ b/src/cppcache/src/LocalRegion.hpp
@@ -45,7 +45,6 @@
 #include "RegionInternal.hpp"
 #include "RegionStats.hpp"
 #include "EntriesMapFactory.hpp"
-#include "SpinLock.hpp"
 #include "SerializationRegistry.hpp"
 #include "MapWithLock.hpp"
 #include "CacheableToken.hpp"

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/SpinLock.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SpinLock.cpp b/src/cppcache/src/SpinLock.cpp
deleted file mode 100644
index 797f0d5..0000000
--- a/src/cppcache/src/SpinLock.cpp
+++ /dev/null
@@ -1,37 +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 <geode/geode_globals.hpp>
-
-#include "SpinLock.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-
-void* testSpinLockCreate() { return (void*)new SpinLock(); }
-
-void testSpinLockAcquire(void* lock) {
-  (reinterpret_cast<SpinLock*>(lock))->acquire();
-}
-
-void testSpinLockRelease(void* lock) {
-  (reinterpret_cast<SpinLock*>(lock))->release();
-}
-}  // namespace client
-}  // namespace geode
-}  // namespace apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/SpinLock.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SpinLock.hpp b/src/cppcache/src/SpinLock.hpp
deleted file mode 100644
index d91b7b3..0000000
--- a/src/cppcache/src/SpinLock.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#pragma once
-
-#ifndef GEODE_SPINLOCK_H_
-#define GEODE_SPINLOCK_H_
-
-/*
- * 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 "HostAsm.hpp"
-
-#ifdef DEBUG
-#define GF_SAFELOCK 1
-#else
-#define GF_SAFELOCK 0
-#endif
-
-namespace apache {
-namespace geode {
-namespace client {
-
-/**
- * For an object that needs to be protected by spinlock, declare a field of type
- * SpinLock. To protect the operation, use a SpinLockGuard on the stack to
- * automatically lock and then release when the stack is unwound..
- */
-class CPPCACHE_EXPORT SpinLock {
- public:
-  SpinLock()
-      : m_lockField(0)
-#if GF_SAFELOCK
-        ,
-        m_ownerId(0)
-#endif
-  {
-    HostAsm::spinLockInit(m_lockField);
-  }
-
-  ~SpinLock() {}
-
-  void acquire() {
-#if GF_SAFELOCK
-    int32_t ownerId = (int32_t)ACE_OS::thr_self();
-    GF_R_ASSERT(
-        (ownerId == 0) ||
-        (ownerId !=
-         m_ownerId));  // detect attempt to lock something I already have.
-#endif
-    HostAsm::spinLockAcquire(m_lockField);
-#if GF_SAFELOCK
-    m_ownerId = ownerId;
-#endif
-  }
-
-  void release() {
-#if GF_SAFELOCK
-    m_ownerId = 0;
-#endif
-    HostAsm::spinLockRelease(m_lockField);
-  }
-
- private:
-  SpinLockField m_lockField;
-#if GF_SAFELOCK
-  int32_t m_ownerId;
-#endif
-};
-
-/**
- * Example:
- *  class Foo {
- *    private:
- *
- *    SpinLock m_lock;
- *
- *    public:
- *
- *    Bool doSomething( )
- *    { SpinLockGuard __guard( m_lock );
- *      if ( ?? ) {
- *        return false;
- *      } else {
- *        if ( ?? ) throw ??
- *        return true;
- *      }
- *    }
- *  };
- *
- * The lock is automatically released no matter what return path is taken.
- */
-class SpinLockGuard {
- public:
-  SpinLockGuard(SpinLock& spinlock) : m_lock(spinlock) { m_lock.acquire(); }
-
-  ~SpinLockGuard() { m_lock.release(); }
-
- private:
-  SpinLock& m_lock;
-};
-
-// Test function
-CPPCACHE_EXPORT void* testSpinLockCreate();
-CPPCACHE_EXPORT void testSpinLockAcquire(void* lock);
-CPPCACHE_EXPORT void testSpinLockRelease(void* lock);
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
-
-#endif  // GEODE_SPINLOCK_H_

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/TcrEndpoint.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrEndpoint.hpp b/src/cppcache/src/TcrEndpoint.hpp
index 77ab3ab..61d43d2 100644
--- a/src/cppcache/src/TcrEndpoint.hpp
+++ b/src/cppcache/src/TcrEndpoint.hpp
@@ -30,7 +30,6 @@
 #include "Set.hpp"
 #include "TcrConnection.hpp"
 #include "Task.hpp"
-#include "SpinLock.hpp"
 
 namespace apache {
 namespace geode {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/80fd387e/src/cppcache/src/hostsolaris.asm
----------------------------------------------------------------------
diff --git a/src/cppcache/src/hostsolaris.asm b/src/cppcache/src/hostsolaris.asm
index 03ae101..7a12bde 100644
--- a/src/cppcache/src/hostsolaris.asm
+++ b/src/cppcache/src/hostsolaris.asm
@@ -103,86 +103,3 @@ retryAddLong:                      ! do {
         retl 
         mov     %o3,%o0            ! return old value of *ctrPtr in %o0
 
-/*========================================================================
- *
- * Name - HostAsmUnlock
- *
- * Purpose -
- *      Unlock the specified lock.
- *
- *========================================================================
- */
-        .proc   16
-        .global HostAsmUnlock
-        .type HostAsmUnlock, #function
-HostAsmUnlock:
-        membar  #StoreStore | #LoadStore | #StoreLoad |  #LoadLoad
-        retl
-        st      %o0,[%o1]  ! store word, 32 bit
-!        st      %g0,[%o0]  ! store word, 32 bit
-
-/*========================================================================
- *
- * Name - HostAsmTryLock
- *
- * bool HostAsmTryLock(SpinLockField *lockPtr, int32_t count, uint32_t lockVal);
- * Purpose -
- *      Try to get access to the specified lock.  If it succeeds in getting
- *      the lock in the number of tries specified in by count,
- *      TRUE is returned.  If the lock is not available with the count
- *      tries, it returns FALSE.
- *
- *========================================================================
- */
-        .seg    "text"
-        .proc   16
-        .global HostAsmTryLock
-        .type HostAsmTryLock, #function
-HostAsmTryLock:
-                                        ! %o0 = lockPtr
-                                        ! %o1 = count
-                                        ! %o2 = lock value to store
-
-        ld      [%o0],%o3               ! load *lockPtr
-        tst     %o3                     ! test if 0
-        bne     spinLoop                ! if not 0 we must spin
-        mov     %o2, %o3                ! branch delay slot, new value into o3
-tryLock:
-                                   ! %o0 = memPtr
-                                   ! %g0 = oldValue (zero)
-                                   ! %o3 = newValue
-                                   ! if (%g0 == *memPtr)
-                                   !   tmp = *memPtr, *memPtr = %o3, %o3 = tmp
-                                   ! else
-                                   !   %o3 = *memPtr
-        cas     [%o0], %g0, %o3
-
-        tst     %o3                     ! what was value in lock word
-        be,a    return                  ! if 0 go to return
-        mov     1,%o3                   ! set return value
-
-
-
-spinLoop:
-        ld      [%o0],%o3               ! load *lockPtr
-        tst     %o3                     ! test if 0
-        be      tryLock                 ! if 0 we can retry the atomic swap
-        mov     %o2, %o3                ! branch delay slot, new value into o3
-
-        nop                             !  delay to limit frequency of probing
-        nop                             !    shared memory
-        nop
-        nop
-        nop
-
-        dec     %o1                     ! count--
-        tst     %o1                     ! test count
-        bg      spinLoop                ! count > 0 go to spinLoop
-        nop                             ! branch delay slot
-
-        mov     0,%o3                   ! fail because count ran out
-
-return:
-        membar  #LoadLoad | #LoadStore |  #StoreStore  | #StoreLoad
-        retl
-        add     %g0,%o3,%o0             ! move result to %o0 for return