Reduce cs_main locks during modal overlay by adding an atomic cache

This commit is contained in:
Jonas Schnelli
2017-04-19 18:45:11 +02:00
parent c91ca0ace9
commit 7148f5e7d7
2 changed files with 31 additions and 12 deletions

View File

@@ -51,8 +51,8 @@ public:
//! Return number of connections, default is in- and outbound (total)
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
int getNumBlocks() const;
int getHeaderTipHeight() const;
int64_t getHeaderTipTime() const;
int getHeaderTipHeight();
int64_t getHeaderTipTime();
//! Return number of transactions in the mempool
long getMempoolSize() const;
//! Return the dynamic memory usage of the mempool
@@ -81,6 +81,10 @@ public:
QString formatClientStartupTime() const;
QString dataDir() const;
// caches for the best header
std::atomic<int> cachedBestHeaderHeight;
std::atomic<int64_t> cachedBestHeaderTime;
private:
OptionsModel *optionsModel;
PeerTableModel *peerTableModel;