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 @@
#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 )
{
......
......@@ -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;
......
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