summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-05-29 21:18:29 +0200
committerMichael Stahl <mstahl@redhat.com>2013-05-29 23:52:12 +0200
commit68ba2785c55eaa1ea70ce135bdad5322b0e04ed7 (patch)
tree0098901b35822c3f7af771d36ae93cdf9991cb3c /ucb
parentcdc0733e83196c39998163d4e6ca2430c7ac03e1 (diff)
ucb: NeonLockStore::stopTicker(): avoid deadlock
Tor reports that NeonLockStore::stopTicker() m_pTickerThread->join() can deadlock with TickerThread running NeonLockStore::refreshLocks(). This can be avoided by copying m_pTickerThread to the stack, and releasing the m_aMutex before calling join(). Change-Id: I387f83a530c5b893f79fa677b1092e0902c8af65
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-neon/NeonLockStore.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx
index 04608a63f725..043ea7d27d72 100644
--- a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx
@@ -128,14 +128,21 @@ void NeonLockStore::startTicker()
void NeonLockStore::stopTicker()
{
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pTickerThread.is() )
+ rtl::Reference<TickerThread> pTickerThread;
{
- m_pTickerThread->finish();
- m_pTickerThread->join();
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if (!m_pTickerThread.is())
+ {
+ return; // nothing to do
+ }
+ m_pTickerThread->finish(); // needs mutex
+ // the TickerThread may run refreshLocks() at most once after this
+ pTickerThread = m_pTickerThread;
m_pTickerThread.clear();
}
+
+ pTickerThread->join(); // without m_aMutex locked (to prevent deadlock)
}
void NeonLockStore::registerSession( HttpSession * pHttpSession )