Kaydet (Commit) 1997de86 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove single, unnecessary use of framework::WriteGuard::downgrade

...and its implementation, and the now-unused E_READLOCK cases.

Change-Id: I2df514f9351a1b63da3063c8db9892e11e9bf83b
üst 571a34e3
...@@ -102,24 +102,11 @@ class WriteGuard : private boost::noncopyable ...@@ -102,24 +102,11 @@ class WriteGuard : private boost::noncopyable
*//*-*****************************************************************************************************/ *//*-*****************************************************************************************************/
inline void lock() inline void lock()
{ {
switch( m_eMode ) if ( m_eMode == E_NOLOCK ) {
{ // Acquire write access and set return state.
case E_NOLOCK : { // Mode is set later if it was successful!
// Acquire write access and set return state. m_pLock->acquire();
// Mode is set later if it was successful! m_eMode = E_WRITELOCK;
m_pLock->acquire();
m_eMode = E_WRITELOCK;
}
break;
case E_READLOCK : {
// User has downgrade to read access before!
// We must release it before we can set a new write access!
m_pLock->release();
m_pLock->acquire();
m_eMode = E_WRITELOCK;
}
break;
default: break; // nothing to do
} }
} }
...@@ -137,41 +124,9 @@ class WriteGuard : private boost::noncopyable ...@@ -137,41 +124,9 @@ class WriteGuard : private boost::noncopyable
*//*-*****************************************************************************************************/ *//*-*****************************************************************************************************/
inline void unlock() inline void unlock()
{ {
switch( m_eMode ) if ( m_eMode == E_WRITELOCK ) {
{ m_pLock->release();
case E_READLOCK : { m_eMode = E_NOLOCK;
// User has downgraded to a read lock before!
// => There isn't really a write lock ...
m_pLock->release();
m_eMode = E_NOLOCK;
}
break;
case E_WRITELOCK : {
m_pLock->release();
m_eMode = E_NOLOCK;
}
break;
default: break; // nothing to do
}
}
/*-****************************************************************************************************
@short downgrade write access to read access without new blocking!
@descr If this write lock is set you can change it to a "read lock".
An "upgrade" is the same like new calling "lock()"!
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
inline void downgrade()
{
if( m_eMode == E_WRITELOCK )
{
m_eMode = E_READLOCK;
} }
} }
......
...@@ -104,10 +104,6 @@ void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xF ...@@ -104,10 +104,6 @@ void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xF
// If removed frame was the current active frame - reset state variable. // If removed frame was the current active frame - reset state variable.
if (m_xActiveFrame==xFrame) if (m_xActiveFrame==xFrame)
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >(); m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
// We don't need the write lock any longer ...
// downgrade to read access.
aWriteLock.downgrade();
} }
aWriteLock.unlock(); aWriteLock.unlock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment