mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +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
|
@ -315,14 +315,23 @@ CRefMgr::getCookieRef_impl( CookieID cookieID )
|
|||
void
|
||||
CRefMgr::CheckHeartbeats( time_t now )
|
||||
{
|
||||
RWReadLock rwl( &m_cookieMapRWLock );
|
||||
CookieMap::iterator iter = m_cookieMap.begin();
|
||||
while ( iter != m_cookieMap.end() ) {
|
||||
SafeCref scr( iter->second );
|
||||
vector<CookieRef*> crefs;
|
||||
|
||||
{
|
||||
RWReadLock rwl( &m_cookieMapRWLock );
|
||||
CookieMap::iterator iter = m_cookieMap.begin();
|
||||
while ( iter != m_cookieMap.end() ) {
|
||||
crefs.push_back(iter->second);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
for ( i = 0; i < crefs.size(); ++i ) {
|
||||
SafeCref scr( crefs[i] );
|
||||
if ( scr.IsValid() ) {
|
||||
scr.CheckHeartbeats( now );
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
} /* CheckHeartbeats */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue