mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-17 04:11:33 +02:00
refactor: Replace RecursiveMutex with Mutex in timedata.cpp
This commit is contained in:
parent
17cfa52d38
commit
c2410ceb84
@ -16,8 +16,8 @@
|
|||||||
#include <warnings.h>
|
#include <warnings.h>
|
||||||
|
|
||||||
|
|
||||||
static RecursiveMutex cs_nTimeOffset;
|
static Mutex g_timeoffset_mutex;
|
||||||
static int64_t nTimeOffset GUARDED_BY(cs_nTimeOffset) = 0;
|
static int64_t nTimeOffset GUARDED_BY(g_timeoffset_mutex) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Never go to sea with two chronometers; take one or three."
|
* "Never go to sea with two chronometers; take one or three."
|
||||||
@ -28,7 +28,7 @@ static int64_t nTimeOffset GUARDED_BY(cs_nTimeOffset) = 0;
|
|||||||
*/
|
*/
|
||||||
int64_t GetTimeOffset()
|
int64_t GetTimeOffset()
|
||||||
{
|
{
|
||||||
LOCK(cs_nTimeOffset);
|
LOCK(g_timeoffset_mutex);
|
||||||
return nTimeOffset;
|
return nTimeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ static int64_t abs64(int64_t n)
|
|||||||
|
|
||||||
void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
|
void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
|
||||||
{
|
{
|
||||||
LOCK(cs_nTimeOffset);
|
LOCK(g_timeoffset_mutex);
|
||||||
// Ignore duplicates
|
// Ignore duplicates
|
||||||
static std::set<CNetAddr> setKnown;
|
static std::set<CNetAddr> setKnown;
|
||||||
if (setKnown.size() == BITCOIN_TIMEDATA_MAX_SAMPLES)
|
if (setKnown.size() == BITCOIN_TIMEDATA_MAX_SAMPLES)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user