mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
fix deadlock by collecting crefs into local storage before starting to
act on them.
This commit is contained in:
parent
7803fead80
commit
0134c96962
1 changed files with 14 additions and 5 deletions
|
@ -314,15 +314,24 @@ CRefMgr::getCookieRef_impl( CookieID cookieID )
|
||||||
|
|
||||||
void
|
void
|
||||||
CRefMgr::CheckHeartbeats( time_t now )
|
CRefMgr::CheckHeartbeats( time_t now )
|
||||||
|
{
|
||||||
|
vector<CookieRef*> crefs;
|
||||||
|
|
||||||
{
|
{
|
||||||
RWReadLock rwl( &m_cookieMapRWLock );
|
RWReadLock rwl( &m_cookieMapRWLock );
|
||||||
CookieMap::iterator iter = m_cookieMap.begin();
|
CookieMap::iterator iter = m_cookieMap.begin();
|
||||||
while ( iter != m_cookieMap.end() ) {
|
while ( iter != m_cookieMap.end() ) {
|
||||||
SafeCref scr( iter->second );
|
crefs.push_back(iter->second);
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int i;
|
||||||
|
for ( i = 0; i < crefs.size(); ++i ) {
|
||||||
|
SafeCref scr( crefs[i] );
|
||||||
if ( scr.IsValid() ) {
|
if ( scr.IsValid() ) {
|
||||||
scr.CheckHeartbeats( now );
|
scr.CheckHeartbeats( now );
|
||||||
}
|
}
|
||||||
++iter;
|
|
||||||
}
|
}
|
||||||
} /* CheckHeartbeats */
|
} /* CheckHeartbeats */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue