Added a name to the RsMutex class.

You can enable the debugging of the waiting time for a lock of RsMutex in rsthreads.h with
#define RSMUTEX_DEBUG 300
That means all locks waiting longer than 300ms are logged into the stderr.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4392 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-07-04 22:59:39 +00:00
parent a94568ac33
commit de87a89437
42 changed files with 103 additions and 64 deletions

View file

@ -63,7 +63,7 @@ std::ostream &operator<<(std::ostream &out, const CacheData &d)
********************************* Cache Store / Source *************************/
CacheSource::CacheSource(uint16_t t, bool m, CacheStrapper *cs, std::string cachedir)
:cacheType(t), multiCache(m), mStrapper(cs), cacheDir(cachedir)
:cacheType(t), multiCache(m), mStrapper(cs), cacheDir(cachedir), cMutex("CacheSource")
{
return;
}
@ -218,7 +218,7 @@ void CacheSource::listCaches(std::ostream &out)
CacheStore::CacheStore(uint16_t t, bool m,
CacheStrapper *cs, CacheTransfer *cft, std::string cachedir)
:cacheType(t), multiCache(m), mStrapper(cs),
cacheTransfer(cft), cacheDir(cachedir)
cacheTransfer(cft), cacheDir(cachedir), cMutex("CacheStore")
{
/* not much */
return;
@ -543,7 +543,7 @@ void CacheStore::locked_storeCacheEntry(const CacheData &data)
********************************* CacheStrapper ********************************/
CacheStrapper::CacheStrapper(p3ConnectMgr *cm)
:p3Config(CONFIG_TYPE_CACHE), mConnMgr(cm)
:p3Config(CONFIG_TYPE_CACHE), mConnMgr(cm), csMtx("CacheStrapper")
{
return;
}

View file

@ -50,7 +50,7 @@
// ***********/
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid,const std::string& config_dir)
:CacheSource(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cachedir), fi(pid),
:CacheSource(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cachedir), fiMutex("FileIndexMonitor"), fi(pid),
pendingDirs(false), pendingForceCacheWrite(false),
mForceCheck(false), mInCheck(false),cb(cb_in), hashCache(config_dir+"/" + "file_cache.lst"),useHashCache(true)

View file

@ -50,7 +50,7 @@ static const char FILE_CACHE_SEPARATOR_CHAR = '|' ;
* #define FI_DEBUG_ALL 1
****/
static RsMutex FIndexPtrMtx ;
static RsMutex FIndexPtrMtx("FIndexPtrMtx") ;
std::tr1::unordered_set<void*> FileIndex::_pointers ;
void FileIndex::registerEntry(void*p)