diff options
author | Noel Grandin <noel@peralex.com> | 2014-07-11 14:41:02 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-07-11 14:41:02 +0200 |
commit | c62e854ee40d427153b9f5d0c1d93b6ee0b13bfa (patch) | |
tree | 70150af8a805392276a6edc55511137388123957 | |
parent | 0cca713f69710d1312acdde9115b359dd8bfc010 (diff) |
convert sw/ObservableThread to salhelper::SimpleReferenceObject
instead of re-implementing it's own reference counting
Change-Id: I2600b970544f1dfd84b987d1891c79e3c377bd1b
-rw-r--r-- | sw/source/core/docnode/observablethread.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/inc/observablethread.hxx | 13 |
2 files changed, 8 insertions, 21 deletions
diff --git a/sw/source/core/docnode/observablethread.cxx b/sw/source/core/docnode/observablethread.cxx index ab225eb1a46b..2be12d4e56fa 100644 --- a/sw/source/core/docnode/observablethread.cxx +++ b/sw/source/core/docnode/observablethread.cxx @@ -25,8 +25,7 @@ #i73788# */ ObservableThread::ObservableThread() - : mnRefCount( 0 ), - mnThreadID( 0 ), + : mnThreadID( 0 ), mpThreadListener() { } @@ -35,19 +34,6 @@ ObservableThread::~ObservableThread() { } -oslInterlockedCount ObservableThread::acquire() -{ - return osl_atomic_increment( &mnRefCount ); -} - -oslInterlockedCount ObservableThread::release() -{ - oslInterlockedCount nCount( osl_atomic_decrement( &mnRefCount ) ); - if ( nCount == 0 ) - delete this; - return nCount; -} - void ObservableThread::SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener, const oslInterlockedCount nThreadID ) { diff --git a/sw/source/core/inc/observablethread.hxx b/sw/source/core/inc/observablethread.hxx index 4096f3c9b02a..13b4527f5d74 100644 --- a/sw/source/core/inc/observablethread.hxx +++ b/sw/source/core/inc/observablethread.hxx @@ -25,6 +25,7 @@ #include <boost/weak_ptr.hpp> #include <ithreadlistenerowner.hxx> +#include <salhelper/simplereferenceobject.hxx> /** class for an observable thread @@ -37,7 +38,7 @@ to notify, that the thread has finished its work. */ class ObservableThread : public osl::Thread, - public rtl::IReference + public salhelper::SimpleReferenceObject { public: @@ -46,9 +47,11 @@ class ObservableThread : public osl::Thread, void SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener, const oslInterlockedCount nThreadID ); - // IReference - virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; - virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE; + static inline void * operator new(std::size_t size) + { return SimpleReferenceObject::operator new(size); } + + static inline void operator delete(void * pointer) + { SimpleReferenceObject::operator delete(pointer); } protected: @@ -79,8 +82,6 @@ class ObservableThread : public osl::Thread, private: - oslInterlockedCount mnRefCount; - oslInterlockedCount mnThreadID; boost::weak_ptr< IFinishedThreadListener > mpThreadListener; |