mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge branch 'lockcontention' of https://github.com/TheBlueMatt/bitcoin
This commit is contained in:
commit
a702ceaafc
23
src/util.cpp
23
src/util.cpp
@ -1153,7 +1153,18 @@ static void pop_lock()
|
||||
void CCriticalSection::Enter(const char* pszName, const char* pszFile, int nLine)
|
||||
{
|
||||
push_lock(this, CLockLocation(pszName, pszFile, nLine));
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
bool result = mutex.try_lock();
|
||||
if (!result)
|
||||
{
|
||||
printf("LOCKCONTENTION: %s\n", pszName);
|
||||
printf("Locker: %s:%d\n", pszFile, nLine);
|
||||
mutex.lock();
|
||||
printf("Locked\n");
|
||||
}
|
||||
#else
|
||||
mutex.lock();
|
||||
#endif
|
||||
}
|
||||
void CCriticalSection::Leave()
|
||||
{
|
||||
@ -1170,10 +1181,20 @@ bool CCriticalSection::TryEnter(const char* pszName, const char* pszFile, int nL
|
||||
|
||||
#else
|
||||
|
||||
void CCriticalSection::Enter(const char*, const char*, int)
|
||||
void CCriticalSection::Enter(const char* pszName, const char* pszFile, int nLine)
|
||||
{
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
bool result = mutex.try_lock();
|
||||
if (!result)
|
||||
{
|
||||
printf("LOCKCONTENTION: %s\n", pszName);
|
||||
printf("Locker: %s:%d\n", pszFile, nLine);
|
||||
mutex.lock();
|
||||
}
|
||||
#else
|
||||
mutex.lock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CCriticalSection::Leave()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user