LibreOffice Module sw (master)  1
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ObservableThread Class Referenceabstract

class for an observable thread More...

#include <observablethread.hxx>

Inheritance diagram for ObservableThread:
[legend]
Collaboration diagram for ObservableThread:
[legend]

Public Member Functions

virtual ~ObservableThread () override
 
void SetListener (std::weak_ptr< IFinishedThreadListener > const &pThreadListener, const oslInterlockedCount nThreadID)
 
- Public Member Functions inherited from salhelper::SimpleReferenceObject
 SimpleReferenceObject ()
 
void acquire ()
 
void release ()
 

Protected Member Functions

 ObservableThread ()
 
virtual void SAL_CALL run () override
 intrinsic function of the thread More...
 
virtual void threadFunction ()=0
 
virtual void SAL_CALL onTerminated () override
 method called, when thread has finished its work More...
 
- Protected Member Functions inherited from salhelper::SimpleReferenceObject
virtual ~SimpleReferenceObject () COVERITY_NOEXCEPT_FALSE
 

Private Attributes

oslInterlockedCount mnThreadID
 
std::weak_ptr< IFinishedThreadListenermpThreadListener
 

Additional Inherited Members

- Static Public Member Functions inherited from salhelper::SimpleReferenceObject
static voidoperator new (std::size_t nSize)
 
static voidoperator new (std::size_t nSize, std::nothrow_t const &rNothrow)
 
static void operator delete (void *pPtr)
 
static void operator delete (void *pPtr, std::nothrow_t const &rNothrow)
 
- Protected Attributes inherited from salhelper::SimpleReferenceObject
oslInterlockedCount m_nCount
 

Detailed Description

class for an observable thread

OD 2007-01-29 #i73788# Note: A thread is ref-counted. Thus, an instance of a derived class has to to be hold via a reference. The thread itself assures during its execution, that the ref-count is increased. Its execution starts with its <run()> method and ends with its <onTerminated()> method. Note: A thread can be only observed by one or none thread observer in order to notify, that the thread has finished its work.

Definition at line 39 of file observablethread.hxx.

Constructor & Destructor Documentation

ObservableThread::~ObservableThread ( )
overridevirtual

Definition at line 34 of file observablethread.cxx.

ObservableThread::ObservableThread ( )
protected

Definition at line 28 of file observablethread.cxx.

Member Function Documentation

void SAL_CALL ObservableThread::onTerminated ( )
overrideprotectedvirtual

method called, when thread has finished its work

Important note: Do not override this method again. Instead override <threadFinished()>. Otherwise, it's not guaranteed, that the ref-count is decreased at the end of its execution and that the observer is notified, that the thread has finished its work.

Definition at line 52 of file observablethread.cxx.

References mnThreadID, mpThreadListener, and salhelper::SimpleReferenceObject::release().

void SAL_CALL ObservableThread::run ( )
overrideprotectedvirtual

intrinsic function of the thread

Important note: Do not override this method again. Instead override <threadFunction()>. Otherwise, it's not guaranteed, that its ref-count is increased during the execution of the thread.

Definition at line 45 of file observablethread.cxx.

References salhelper::SimpleReferenceObject::acquire(), and threadFunction().

void ObservableThread::SetListener ( std::weak_ptr< IFinishedThreadListener > const &  pThreadListener,
const oslInterlockedCount  nThreadID 
)

Definition at line 38 of file observablethread.cxx.

References mnThreadID, and mpThreadListener.

Referenced by ThreadListener::ListenToThread().

virtual void ObservableThread::threadFunction ( )
protectedpure virtual

Implemented in SwAsyncRetrieveInputStreamThread.

Referenced by run().

Member Data Documentation

oslInterlockedCount ObservableThread::mnThreadID
private

Definition at line 80 of file observablethread.hxx.

Referenced by onTerminated(), and SetListener().

std::weak_ptr< IFinishedThreadListener > ObservableThread::mpThreadListener
private

Definition at line 82 of file observablethread.hxx.

Referenced by onTerminated(), and SetListener().


The documentation for this class was generated from the following files: