summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/Shared.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2005-07-05 11:09:55 +0000
committerDwayne Boone <dwayne@zeroc.com>2005-07-05 11:09:55 +0000
commit9b8cc712d4a41d71840416776bc94ee8485bb9b3 (patch)
tree7d467fdd6a66bc2b5878d82070d45adbd5c20414 /cppe/src/IceE/Shared.cpp
parentcleaning the cache method out of ReferenceFactory (diff)
downloadice-9b8cc712d4a41d71840416776bc94ee8485bb9b3.tar.bz2
ice-9b8cc712d4a41d71840416776bc94ee8485bb9b3.tar.xz
ice-9b8cc712d4a41d71840416776bc94ee8485bb9b3.zip
Changed Ice to IceE EVERYWHERE!!!
Diffstat (limited to 'cppe/src/IceE/Shared.cpp')
-rw-r--r--cppe/src/IceE/Shared.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/cppe/src/IceE/Shared.cpp b/cppe/src/IceE/Shared.cpp
new file mode 100644
index 00000000000..196c7256589
--- /dev/null
+++ b/cppe/src/IceE/Shared.cpp
@@ -0,0 +1,67 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICEE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <IceE/Shared.h>
+
+using namespace IceE;
+
+IceE::SimpleShared::SimpleShared() :
+ _ref(0),
+ _noDelete(false)
+{
+}
+
+IceE::SimpleShared::SimpleShared(const SimpleShared&) :
+ _ref(0),
+ _noDelete(false)
+{
+}
+
+IceE::Shared::Shared() :
+#ifndef ICEE_HAS_ATOMIC_FUNCTIONS
+ _ref(0),
+#endif
+ _noDelete(false)
+{
+#ifdef ICEE_HAS_ATOMIC_FUNCTIONS
+ ice_atomic_set(&_ref, 0);
+#endif
+}
+
+IceE::Shared::Shared(const Shared&) :
+#ifndef ICEE_HAS_ATOMIC_FUNCTIONS
+ _ref(0),
+#endif
+ _noDelete(false)
+{
+#ifdef ICEE_HAS_ATOMIC_FUNCTIONS
+ ice_atomic_set(&_ref, 0);
+#endif
+}
+
+int
+IceE::Shared::__getRef() const
+{
+#if defined(_WIN32)
+ return InterlockedExchangeAdd(const_cast<LONG*>(&_ref), 0);
+#elif defined(ICEE_HAS_ATOMIC_FUNCTIONS)
+ return ice_atomic_exchange_add(0, const_cast<ice_atomic_t*>(&_ref));
+#else
+ _mutex.lock();
+ int ref = _ref;
+ _mutex.unlock();
+ return ref;
+#endif
+}
+
+void
+IceE::Shared::__setNoDelete(bool b)
+{
+ _noDelete = b;
+}