diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2011-02-16 14:37:01 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2011-02-16 14:37:01 +0100 |
commit | 9d1f566b61ed3872dc74535855f5c76cb0fb18b7 (patch) | |
tree | 3f0dc64bc85851dae64854263a437dfd3c95bf7d /extensions | |
parent | 725c97e1681f90ae2a55a30036767ae202f599bb (diff) | |
parent | eea25f8ba6577cd84e974f3b440d00479610e2bb (diff) |
CWS-TOOLING: integrate CWS sb138
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/oooimprovement/onlogrotate_job.cxx | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/extensions/source/oooimprovement/onlogrotate_job.cxx b/extensions/source/oooimprovement/onlogrotate_job.cxx index d83c43bfcfd8..e1f9cf717584 100644 --- a/extensions/source/oooimprovement/onlogrotate_job.cxx +++ b/extensions/source/oooimprovement/onlogrotate_job.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/ucb/XSimpleFileAccess.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <osl/mutex.hxx> +#include <osl/conditn.hxx> #include <osl/thread.hxx> #include <osl/time.h> #include <cppuhelper/implbase1.hxx> @@ -108,49 +108,41 @@ namespace public: OnLogRotateThread(Reference<XMultiServiceFactory> sf); virtual void SAL_CALL run(); - OnLogRotateThread* disposing(); + void stop(); private: Reference<XMultiServiceFactory> m_ServiceFactory; - ::osl::Mutex m_ServiceFactoryMutex; + ::osl::Condition m_Stop; }; OnLogRotateThread::OnLogRotateThread(Reference<XMultiServiceFactory> sf) : m_ServiceFactory(sf) - { } + { + OSL_ASSERT(sf.is()); + } void SAL_CALL OnLogRotateThread::run() { + TimeValue wait_intervall = {30,0}; + if (m_Stop.wait(&wait_intervall) == ::osl::Condition::result_timeout) { - ::osl::Thread::yield(); - TimeValue wait_intervall = {30,0}; - osl_waitThread(&wait_intervall); - } - { - ::osl::Guard< ::osl::Mutex> service_factory_guard(m_ServiceFactoryMutex); try { - if(m_ServiceFactory.is()) + if(Config(m_ServiceFactory).getInvitationAccepted()) { - if(Config(m_ServiceFactory).getInvitationAccepted()) - { - packLogs(m_ServiceFactory); - uploadLogs(m_ServiceFactory); - } - else - LogStorage(m_ServiceFactory).clear(); + packLogs(m_ServiceFactory); + uploadLogs(m_ServiceFactory); } - m_ServiceFactory.clear(); + else + LogStorage(m_ServiceFactory).clear(); } catch(...) {} } } - OnLogRotateThread* OnLogRotateThread::disposing() + void OnLogRotateThread::stop() { - ::osl::Guard< ::osl::Mutex> service_factory_guard(m_ServiceFactoryMutex); - m_ServiceFactory.clear(); - return this; + m_Stop.set(); } class OnLogRotateThreadWatcher : public ::cppu::WeakImplHelper1<XTerminateListener> @@ -163,7 +155,7 @@ namespace } virtual ~OnLogRotateThreadWatcher() { - m_Thread->disposing()->terminate(); + m_Thread->stop(); m_Thread->join(); }; @@ -172,13 +164,13 @@ namespace { }; virtual void SAL_CALL notifyTermination(const EventObject&) throw(RuntimeException) { - m_Thread->disposing()->terminate(); + m_Thread->stop(); m_Thread->join(); }; // XEventListener virtual void SAL_CALL disposing(const EventObject&) throw(RuntimeException) { - m_Thread->disposing()->terminate(); + m_Thread->stop(); m_Thread->join(); }; private: |