Kaydet (Commit) c62e854e authored tarafından Noel Grandin's avatar Noel Grandin

convert sw/ObservableThread to salhelper::SimpleReferenceObject

instead of re-implementing it's own reference counting

Change-Id: I2600b970544f1dfd84b987d1891c79e3c377bd1b
üst 0cca713f
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
#i73788# #i73788#
*/ */
ObservableThread::ObservableThread() ObservableThread::ObservableThread()
: mnRefCount( 0 ), : mnThreadID( 0 ),
mnThreadID( 0 ),
mpThreadListener() mpThreadListener()
{ {
} }
...@@ -35,19 +34,6 @@ ObservableThread::~ObservableThread() ...@@ -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, void ObservableThread::SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener,
const oslInterlockedCount nThreadID ) const oslInterlockedCount nThreadID )
{ {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <boost/weak_ptr.hpp> #include <boost/weak_ptr.hpp>
#include <ithreadlistenerowner.hxx> #include <ithreadlistenerowner.hxx>
#include <salhelper/simplereferenceobject.hxx>
/** class for an observable thread /** class for an observable thread
...@@ -37,7 +38,7 @@ ...@@ -37,7 +38,7 @@
to notify, that the thread has finished its work. to notify, that the thread has finished its work.
*/ */
class ObservableThread : public osl::Thread, class ObservableThread : public osl::Thread,
public rtl::IReference public salhelper::SimpleReferenceObject
{ {
public: public:
...@@ -46,9 +47,11 @@ class ObservableThread : public osl::Thread, ...@@ -46,9 +47,11 @@ class ObservableThread : public osl::Thread,
void SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener, void SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener,
const oslInterlockedCount nThreadID ); const oslInterlockedCount nThreadID );
// IReference static inline void * operator new(std::size_t size)
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; { return SimpleReferenceObject::operator new(size); }
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
static inline void operator delete(void * pointer)
{ SimpleReferenceObject::operator delete(pointer); }
protected: protected:
...@@ -79,8 +82,6 @@ class ObservableThread : public osl::Thread, ...@@ -79,8 +82,6 @@ class ObservableThread : public osl::Thread,
private: private:
oslInterlockedCount mnRefCount;
oslInterlockedCount mnThreadID; oslInterlockedCount mnThreadID;
boost::weak_ptr< IFinishedThreadListener > mpThreadListener; boost::weak_ptr< IFinishedThreadListener > mpThreadListener;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment