mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
remove _locked from name of method since it's not called when holding a lock.
This commit is contained in:
parent
53b3d7c32f
commit
c5d113a8da
2 changed files with 17 additions and 19 deletions
|
@ -212,6 +212,7 @@ void
|
||||||
CRefMgr::addToFreeList( CookieRef* cref )
|
CRefMgr::addToFreeList( CookieRef* cref )
|
||||||
{
|
{
|
||||||
MutexLock ml( &m_freeList_mutex );
|
MutexLock ml( &m_freeList_mutex );
|
||||||
|
logf( XW_LOGINFO, "%s(%p)", __func__, cref );
|
||||||
m_freeList.push_back( cref );
|
m_freeList.push_back( cref );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,15 +225,16 @@ CRefMgr::getFromFreeList( void )
|
||||||
cref = m_freeList.front();
|
cref = m_freeList.front();
|
||||||
m_freeList.pop_front();
|
m_freeList.pop_front();
|
||||||
}
|
}
|
||||||
|
logf( XW_LOGINFO, "%s()=>%p", __func__, cref );
|
||||||
return cref;
|
return cref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CookieRef*
|
CookieRef*
|
||||||
CRefMgr::getMakeCookieRef_locked( const char* cookie, HostID hid, int socket,
|
CRefMgr::getMakeCookieRef( const char* cookie, HostID hid, int socket,
|
||||||
int nPlayersH, int nPlayersT, int langCode,
|
int nPlayersH, int nPlayersT, int langCode,
|
||||||
int gameSeed, bool wantsPublic,
|
int gameSeed, bool wantsPublic,
|
||||||
bool makePublic )
|
bool makePublic )
|
||||||
{
|
{
|
||||||
CookieRef* cref;
|
CookieRef* cref;
|
||||||
|
|
||||||
|
@ -265,12 +267,12 @@ CRefMgr::getMakeCookieRef_locked( const char* cookie, HostID hid, int socket,
|
||||||
}
|
}
|
||||||
|
|
||||||
return cref;
|
return cref;
|
||||||
} /* getMakeCookieRef_locked */
|
} /* getMakeCookieRef */
|
||||||
|
|
||||||
/* reconnect case */
|
/* reconnect case */
|
||||||
CookieRef*
|
CookieRef*
|
||||||
CRefMgr::getMakeCookieRef_locked( const char* connName, HostID hid, int socket,
|
CRefMgr::getMakeCookieRef( const char* connName, HostID hid, int socket,
|
||||||
int nPlayersH, int seed )
|
int nPlayersH, int seed )
|
||||||
{
|
{
|
||||||
CookieRef* cref = NULL;
|
CookieRef* cref = NULL;
|
||||||
|
|
||||||
|
@ -454,10 +456,8 @@ CRefMgr::AddNew( const char* cookie, const char* connName, CookieID id,
|
||||||
logf( XW_LOGINFO, "making new cref: %d", id );
|
logf( XW_LOGINFO, "making new cref: %d", id );
|
||||||
|
|
||||||
if ( !!ref ) {
|
if ( !!ref ) {
|
||||||
logf( XW_LOGVERBOSE1, "using from free list" );
|
|
||||||
ref->ReInit( cookie, connName, id, langCode, nPlayers, nAlreadyHere );
|
ref->ReInit( cookie, connName, id, langCode, nPlayers, nAlreadyHere );
|
||||||
} else {
|
} else {
|
||||||
logf( XW_LOGVERBOSE1, "calling constructor" );
|
|
||||||
ref = new CookieRef( cookie, connName, id, langCode, nPlayers,
|
ref = new CookieRef( cookie, connName, id, langCode, nPlayers,
|
||||||
nAlreadyHere );
|
nAlreadyHere );
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ SafeCref::SafeCref( const char* cookie, int socket, int nPlayersH, int nPlayersS
|
||||||
{
|
{
|
||||||
CookieRef* cref;
|
CookieRef* cref;
|
||||||
|
|
||||||
cref = m_mgr->getMakeCookieRef_locked( cookie, 0, socket,
|
cref = m_mgr->getMakeCookieRef( cookie, 0, socket,
|
||||||
nPlayersH, nPlayersS, langCode,
|
nPlayersH, nPlayersS, langCode,
|
||||||
gameSeed, wantsPublic, makePublic );
|
gameSeed, wantsPublic, makePublic );
|
||||||
if ( cref != NULL ) {
|
if ( cref != NULL ) {
|
||||||
|
@ -640,8 +640,7 @@ SafeCref::SafeCref( const char* connName, HostID hid,
|
||||||
{
|
{
|
||||||
CookieRef* cref;
|
CookieRef* cref;
|
||||||
|
|
||||||
cref = m_mgr->getMakeCookieRef_locked( connName, hid, socket, nPlayersH,
|
cref = m_mgr->getMakeCookieRef( connName, hid, socket, nPlayersH, gameSeed );
|
||||||
gameSeed );
|
|
||||||
if ( cref != NULL ) {
|
if ( cref != NULL ) {
|
||||||
m_locked = cref->Lock();
|
m_locked = cref->Lock();
|
||||||
m_cref = cref;
|
m_cref = cref;
|
||||||
|
|
|
@ -136,15 +136,14 @@ class CRefMgr {
|
||||||
CookieRef* getFromFreeList( void );
|
CookieRef* getFromFreeList( void );
|
||||||
|
|
||||||
/* connect case */
|
/* connect case */
|
||||||
CookieRef* getMakeCookieRef_locked( const char* cookie,
|
CookieRef* getMakeCookieRef( const char* cookie,
|
||||||
HostID hid, int socket, int nPlayersH,
|
HostID hid, int socket, int nPlayersH,
|
||||||
int nPlayersS, int langCode, int seed,
|
int nPlayersS, int langCode, int seed,
|
||||||
bool wantsPublic, bool makePublic );
|
bool wantsPublic, bool makePublic );
|
||||||
|
|
||||||
/* reconnect case; just the stuff we don't have in db */
|
/* reconnect case; just the stuff we don't have in db */
|
||||||
CookieRef* getMakeCookieRef_locked( const char* connName,
|
CookieRef* getMakeCookieRef( const char* connName, HostID hid, int socket,
|
||||||
HostID hid, int socket, int nPlayersH,
|
int nPlayersH, int seed );
|
||||||
int seed );
|
|
||||||
|
|
||||||
CookieRef* getCookieRef( CookieID cookieID );
|
CookieRef* getCookieRef( CookieID cookieID );
|
||||||
CookieRef* getCookieRef( int socket );
|
CookieRef* getCookieRef( int socket );
|
||||||
|
|
Loading…
Add table
Reference in a new issue