Tag: cws_src680_dba202d User: fs Date: 06/01/24 01:59:26 Modified: /dba/dbaccess/source/core/dataaccess/ ModelImpl.cxx
Log: RESYNC: (1.9-1.10); FILE MERGED File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.9.24.1&r2=1.9.24.2 Delta lines: +45 -9 -------------------- --- ModelImpl.cxx 27 Dec 2005 12:53:00 -0000 1.9.24.1 +++ ModelImpl.cxx 24 Jan 2006 09:59:22 -0000 1.9.24.2 @@ -117,9 +117,6 @@ #ifndef _DBA_CORE_CONNECTION_HXX_ #include "connection.hxx" #endif -#ifndef _COMPHELPER_GUARDING_HXX_ -#include <comphelper/guarding.hxx> -#endif #ifndef _RTL_DIGEST_H_ #include <rtl/digest.h> #endif @@ -182,6 +179,33 @@ { //........................................................................ +//======================================================================== +//= DocumentStorageAccess +//======================================================================== +//------------------------------------------------------------------------ +SharedMutex::SharedMutex() + :m_refCount( 0 ) +{ +} + +//------------------------------------------------------------------------ +SharedMutex::~SharedMutex() +{ +} + +//------------------------------------------------------------------------ +void SAL_CALL SharedMutex::acquire() +{ + osl_incrementInterlockedCount( &m_refCount ); +} + +//------------------------------------------------------------------------ +void SAL_CALL SharedMutex::release() +{ + if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) + delete this; +} + //============================================================ //= DocumentStorageAccess //============================================================ @@ -377,6 +401,7 @@ ,m_nLoginTimeout(0) ,m_refCount(0) ,m_pStorageAccess( NULL ) + ,m_xMutex( new SharedMutex ) { // some kind of default DBG_CTOR(ODatabaseModelImpl,NULL); @@ -407,6 +432,7 @@ ,m_nLoginTimeout(0) ,m_refCount(0) ,m_pStorageAccess( NULL ) + ,m_xMutex( new SharedMutex ) { DBG_CTOR(ODatabaseModelImpl,NULL); // adjust our readonly flag @@ -472,8 +498,11 @@ //------------------------------------------------------------------------------ void ODatabaseModelImpl::clearConnections() { + OWeakConnectionArray aConnections; + aConnections.swap( m_aConnections ); + Reference< XConnection > xConn; - for (OWeakConnectionArray::iterator i = m_aConnections.begin(); m_aConnections.end() != i; ++i) + for ( OWeakConnectionArray::iterator i = aConnections.begin(); aConnections.end() != i; ++i ) { xConn = *i; if ( xConn.is() ) @@ -488,7 +517,6 @@ } } } - m_aConnections.clear(); m_pSharedConnectionManager = NULL; m_xSharedConnectionManager = NULL; @@ -869,6 +897,14 @@ throw IOException(); } } + +// ----------------------------------------------------------------------------- +ModelDependentComponent::ModelDependentComponent( const ::rtl::Reference< ODatabaseModelImpl >& _model ) + :m_pImpl( _model ) + ,m_xMutex( _model->getSharedMutex() ) +{ +} + //........................................................................ } // namespace dbaccess //........................................................................ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
