summaryrefslogtreecommitdiff
path: root/bridges/source
diff options
context:
space:
mode:
authorJörg Budischewski <jbu@openoffice.org>2000-12-17 18:39:36 +0000
committerJörg Budischewski <jbu@openoffice.org>2000-12-17 18:39:36 +0000
commitbdbe4589968c8e43ed953c6d16729c54a884a075 (patch)
tree527c874d4de5af55a93b1f48502e460501d869c7 /bridges/source
parent77ca3618e6cdcd48e1b90f97c0ec236e77ee6f84 (diff)
#82217# deadlock during bridge disposing fixed
Diffstat (limited to 'bridges/source')
-rw-r--r--bridges/source/remote/urp/urp_environment.cxx25
1 files changed, 21 insertions, 4 deletions
diff --git a/bridges/source/remote/urp/urp_environment.cxx b/bridges/source/remote/urp/urp_environment.cxx
index 37bd6db74f43..a0e50b3129a4 100644
--- a/bridges/source/remote/urp/urp_environment.cxx
+++ b/bridges/source/remote/urp/urp_environment.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: urp_environment.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dbo $ $Date: 2000-12-15 11:10:30 $
+ * last change: $Author: jbu $ $Date: 2000-12-17 19:39:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -232,9 +232,26 @@ void SAL_CALL allThreadsAreGone( uno_Environment * pEnvRemote )
remote_Context *pContext = (remote_Context *) pEnvRemote->pContext;
urp_BridgeImpl *pImpl = ( urp_BridgeImpl *) pContext->m_pBridgeImpl;
- ::osl::MutexGuard guard( pImpl->m_disposingMutex );
+ // if the current thread is not the writer thread, the writer thread
+ // object is not destroyed up to now, though it may already have run out.
+ // In both cases, it must be safe to cal pImpl->m_pWriter->getIdentifier()
+ OSL_ASSERT( pImpl->m_pWriter );
+ if( pImpl->m_pWriter->getIdentifier() == osl_getThreadIdentifier(0) )
+ {
+ // This is the writer thread. It has done some release calls,
+ // and is now the last one, that was active. Because the writer
+ // thread holds the environment weakly, there may also be a thread within
+ // the dispose of the bridge ( because the enviroment may have a refcount == 0 ).
+ // However, this thread MUST wait for the writer thread, so it is perfectly ok,
+ // not to set m_cndWaitForThreads. ( The check for m_nRemoteThreads is done
+ // after the join of the writer thread ).
+ }
+ else
+ {
+ ::osl::MutexGuard guard( pImpl->m_disposingMutex );
- pImpl->m_cndWaitForThreads.set();
+ pImpl->m_cndWaitForThreads.set();
+ }
}