summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-02-23 10:28:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-02-23 10:47:35 +0100
commitf7afe3b7b07800d130b4d9102f2a94ccac0ebc52 (patch)
tree152d343afbdcd75041169b46dd3725e3b5214610 /ucb
parent123c59342c7191ae7972b76da2ccd28788ac7cee (diff)
Adapted TickerThread to safer-to-use salhelper::Thread
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav/NeonLockStore.cxx26
-rw-r--r--ucb/source/ucp/webdav/NeonLockStore.hxx2
2 files changed, 14 insertions, 14 deletions
diff --git a/ucb/source/ucp/webdav/NeonLockStore.cxx b/ucb/source/ucp/webdav/NeonLockStore.cxx
index 1ad726aec039..3c84ad337b17 100644
--- a/ucb/source/ucp/webdav/NeonLockStore.cxx
+++ b/ucb/source/ucp/webdav/NeonLockStore.cxx
@@ -32,6 +32,7 @@
#include "rtl/ustring.hxx"
#include "osl/time.h"
#include "osl/thread.hxx"
+#include "salhelper/thread.hxx"
#include "NeonSession.hxx"
#include "NeonLockStore.hxx"
@@ -39,7 +40,7 @@ using namespace webdav_ucp;
namespace webdav_ucp {
-class TickerThread : public osl::Thread
+class TickerThread : public salhelper::Thread
{
bool m_bFinish;
NeonLockStore & m_rLockStore;
@@ -47,19 +48,20 @@ class TickerThread : public osl::Thread
public:
TickerThread( NeonLockStore & rLockStore )
- : osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {}
+ : Thread( "NeonTickerThread" ), m_bFinish( false ),
+ m_rLockStore( rLockStore ) {}
void finish() { m_bFinish = true; }
-protected:
+private:
- virtual void SAL_CALL run();
+ virtual void execute();
};
} // namespace webdav_ucp
// -------------------------------------------------------------------
-void TickerThread::run()
+void TickerThread::execute()
{
OSL_TRACE( "TickerThread: start." );
@@ -78,7 +80,7 @@ void TickerThread::run()
TimeValue aTV;
aTV.Seconds = 0;
aTV.Nanosec = 1000000000 / nNth;
- wait( aTV );
+ osl::Thread::wait( aTV );
}
OSL_TRACE( "TickerThread: stop." );
@@ -86,8 +88,7 @@ void TickerThread::run()
// -------------------------------------------------------------------
NeonLockStore::NeonLockStore()
- : m_pNeonLockStore( ne_lockstore_create() ),
- m_pTickerThread( 0 )
+ : m_pNeonLockStore( ne_lockstore_create() )
{
OSL_ENSURE( m_pNeonLockStore, "Unable to create neon lock store!" );
}
@@ -122,10 +123,10 @@ void NeonLockStore::startTicker()
{
osl::MutexGuard aGuard( m_aMutex );
- if ( !m_pTickerThread )
+ if ( !m_pTickerThread.is() )
{
m_pTickerThread = new TickerThread( *this );
- m_pTickerThread->create();
+ m_pTickerThread->launch();
}
}
@@ -134,12 +135,11 @@ void NeonLockStore::stopTicker()
{
osl::MutexGuard aGuard( m_aMutex );
- if ( m_pTickerThread )
+ if ( m_pTickerThread.is() )
{
m_pTickerThread->finish();
m_pTickerThread->join();
- delete m_pTickerThread;
- m_pTickerThread = 0;
+ m_pTickerThread.clear();
}
}
diff --git a/ucb/source/ucp/webdav/NeonLockStore.hxx b/ucb/source/ucp/webdav/NeonLockStore.hxx
index 3b6fbdeb56c3..c8f0f0fcba99 100644
--- a/ucb/source/ucp/webdav/NeonLockStore.hxx
+++ b/ucb/source/ucp/webdav/NeonLockStore.hxx
@@ -69,7 +69,7 @@ class NeonLockStore
{
osl::Mutex m_aMutex;
ne_lock_store * m_pNeonLockStore;
- TickerThread * m_pTickerThread;
+ rtl::Reference< TickerThread > m_pTickerThread;
LockInfoMap m_aLockInfoMap;
public: