Kaydet (Commit) 8b960f0e authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Adapted LateInitThread to safer-to-use salhelper::Thread

üst d3f4ee2b
...@@ -39,6 +39,7 @@ $(eval $(call gb_Library_add_linked_libs,filterconfig,\ ...@@ -39,6 +39,7 @@ $(eval $(call gb_Library_add_linked_libs,filterconfig,\
cppuhelper \ cppuhelper \
cppu \ cppu \
sal \ sal \
salhelper \
$(gb_STDLIBS) \ $(gb_STDLIBS) \
)) ))
......
fl filter : TRANSLATIONS:translations svtools unotools xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt basegfx package PYTHON:python NULL fl filter : TRANSLATIONS:translations svtools unotools xmloff cppu tools cppuhelper sal salhelper svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt basegfx package PYTHON:python NULL
fl filter\prj nmake - all fl_prj NULL fl filter\prj nmake - all fl_prj NULL
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
* *
************************************************************************/ ************************************************************************/
#include "sal/config.h"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "lateinitlistener.hxx" #include "lateinitlistener.hxx"
#include "lateinitthread.hxx" #include "lateinitthread.hxx"
//_______________________________________________
// includes
#include <rtl/ustring.hxx>
//_______________________________________________ //_______________________________________________
// namespace // namespace
...@@ -110,8 +110,11 @@ void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aE ...@@ -110,8 +110,11 @@ void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aE
if (!aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnCloseApp"))) if (!aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnCloseApp")))
{ {
LateInitThread* pThread = new LateInitThread(); rtl::Reference< LateInitThread >(new LateInitThread())->launch();
pThread->create(); //TODO: a protocol is missing how to join with the launched
// thread before exit(3), to ensure the thread is no longer
// relying on any infrastructure while that infrastructure is
// being shut down in atexit handlers
} }
} }
} }
......
...@@ -26,40 +26,21 @@ ...@@ -26,40 +26,21 @@
* *
************************************************************************/ ************************************************************************/
#include "sal/config.h"
#include "lateinitthread.hxx" #include "salhelper/singletonref.hxx"
//_______________________________________________
// includes
//_______________________________________________
// namespace
namespace filter{
namespace config{
namespace css = ::com::sun::star;
//_______________________________________________
// definitions
LateInitThread::LateInitThread()
{
}
#include "filtercache.hxx"
#include "lateinitthread.hxx"
namespace filter { namespace config {
LateInitThread::~LateInitThread() LateInitThread::LateInitThread(): Thread("lateinitthread") {}
{
}
LateInitThread::~LateInitThread() {}
void LateInitThread::execute() {
void SAL_CALL LateInitThread::run() // true => It indicates using of this method by this thread
{
// sal_True => It indicates using of this method by this thread
// The filter cache use this information to show an assertion // The filter cache use this information to show an assertion
// for "optimization failure" in case the first calli of loadAll() // for "optimization failure" in case the first calli of loadAll()
// was not this thread ... // was not this thread ...
...@@ -68,16 +49,10 @@ void SAL_CALL LateInitThread::run() ...@@ -68,16 +49,10 @@ void SAL_CALL LateInitThread::run()
// May be they show the problem of a corrupted filter // May be they show the problem of a corrupted filter
// configuration, which is handled inside our event loop or desktop.main()! // configuration, which is handled inside our event loop or desktop.main()!
::salhelper::SingletonRef< FilterCache > rCache; salhelper::SingletonRef< FilterCache >()->load(
rCache->load(FilterCache::E_CONTAINS_ALL, sal_True); FilterCache::E_CONTAINS_ALL, true);
}
void SAL_CALL LateInitThread::onTerminated()
{
delete this;
} }
} // namespace config } }
} // namespace filter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -26,26 +26,14 @@ ...@@ -26,26 +26,14 @@
* *
************************************************************************/ ************************************************************************/
#ifndef __FILTER_CONFIG_LATEINITTHREAD_HXX_ #ifndef INCLUDED_FILTER_SOURCE_CONFIG_CACHE_LATEINITTHREAD_HXX
#define __FILTER_CONFIG_LATEINITTHREAD_HXX_ #define INCLUDED_FILTER_SOURCE_CONFIG_CACHE_LATEINITTHREAD_HXX
//_______________________________________________ #include "sal/config.h"
// includes
#include "filtercache.hxx" #include "salhelper/thread.hxx"
#include <salhelper/singletonref.hxx>
#include <osl/thread.hxx>
//_______________________________________________ namespace filter{ namespace config {
// namespace
namespace filter{
namespace config{
//_______________________________________________
// definitions
//_______________________________________________
/** @short implements a thread, which will update the /** @short implements a thread, which will update the
global filter cache of an office, after its global filter cache of an office, after its
...@@ -57,38 +45,18 @@ namespace filter{ ...@@ -57,38 +45,18 @@ namespace filter{
@attention The filter cache will be blocked during this thrad runs! @attention The filter cache will be blocked during this thrad runs!
*/ */
class LateInitThread : public ::osl::Thread class LateInitThread: public salhelper::Thread {
{ public:
//------------------------------------------- LateInitThread();
// native interface
public:
//---------------------------------------
// ctor/dtor
/** @short initialize new instance of this class.
*/
LateInitThread();
//---------------------------------------
/** @short standard dtor.
*/
virtual ~LateInitThread();
//---------------------------------------
/** @short thread function. private:
*/ virtual ~LateInitThread();
virtual void SAL_CALL run();
virtual void SAL_CALL onTerminated(); virtual void execute();
}; };
} // namespace config } }
} // namespace filter
#endif // __FILTER_CONFIG_LATEINITTHREAD_HXX_ #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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