summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
authorMartin Neupauer <martin.neupauer@10gen.com>2018-07-09 16:20:02 -0700
committerMartin Neupauer <martin.neupauer@mongodb.com>2018-07-10 13:34:06 -0400
commit01cf7a585de2942562837077dff73968562b91f3 (patch)
tree3817c3359a83c19b31f62e49361f5c2360843f96 /src/mongo/util
parentd1955c0bddabfa76d4c942ecec9110de9534337a (diff)
downloadmongo-01cf7a585de2942562837077dff73968562b91f3.tar.gz
SERVER-35940 Remove IntrusiveCounter
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/intrusive_counter.cpp10
-rw-r--r--src/mongo/util/intrusive_counter.h57
2 files changed, 2 insertions, 65 deletions
diff --git a/src/mongo/util/intrusive_counter.cpp b/src/mongo/util/intrusive_counter.cpp
index 75c3b0f0acc..0e788aa2f2c 100644
--- a/src/mongo/util/intrusive_counter.cpp
+++ b/src/mongo/util/intrusive_counter.cpp
@@ -58,12 +58,4 @@ intrusive_ptr<const RCString> RCString::create(StringData s) {
return ptr;
}
-void IntrusiveCounterUnsigned::addRef() const {
- ++counter;
-}
-
-void IntrusiveCounterUnsigned::release() const {
- if (!--counter)
- delete this;
-}
-}
+} // namespace mongo
diff --git a/src/mongo/util/intrusive_counter.h b/src/mongo/util/intrusive_counter.h
index 76c1bee5a78..0d3b5fc50bf 100644
--- a/src/mongo/util/intrusive_counter.h
+++ b/src/mongo/util/intrusive_counter.h
@@ -38,54 +38,6 @@
namespace mongo {
-/*
- IntrusiveCounter is a sharable implementation of a reference counter that
- objects can use to be compatible with boost::intrusive_ptr<>.
-
- Some objects that use IntrusiveCounter are immutable, and only have
- const methods. This may require their pointers to be declared as
- intrusive_ptr<const ClassName> . In order to be able to share pointers to
- these immutables, the methods associated with IntrusiveCounter are declared
- as const, and the counter itself is marked as mutable.
-
- IntrusiveCounter itself is abstract, allowing for multiple implementations.
- For example, IntrusiveCounterUnsigned uses ordinary unsigned integers for
- the reference count, and is good for situations where thread safety is not
- required. For others, other implementations using atomic integers should
- be used. For static objects, the implementations of addRef() and release()
- can be overridden to do nothing.
- */
-class IntrusiveCounter {
- MONGO_DISALLOW_COPYING(IntrusiveCounter);
-
-public:
- IntrusiveCounter() = default;
- virtual ~IntrusiveCounter(){};
-
- // these are here for the boost intrusive_ptr<> class
- friend inline void intrusive_ptr_add_ref(const IntrusiveCounter* pIC) {
- pIC->addRef();
- };
- friend inline void intrusive_ptr_release(const IntrusiveCounter* pIC) {
- pIC->release();
- };
-
- virtual void addRef() const = 0;
- virtual void release() const = 0;
-};
-
-class IntrusiveCounterUnsigned : public IntrusiveCounter {
-public:
- // virtuals from IntrusiveCounter
- virtual void addRef() const;
- virtual void release() const;
-
- IntrusiveCounterUnsigned();
-
-private:
- mutable unsigned counter;
-};
-
/// This is an alternative base class to the above ones (will replace them eventually)
class RefCountable {
MONGO_DISALLOW_COPYING(RefCountable);
@@ -151,11 +103,4 @@ private:
int _size; // does NOT include trailing NUL byte.
// char[_size+1] array allocated past end of class
};
-};
-
-/* ======================= INLINED IMPLEMENTATIONS ========================== */
-
-namespace mongo {
-
-inline IntrusiveCounterUnsigned::IntrusiveCounterUnsigned() : counter(0) {}
-};
+} // namespace mongo