aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet.h
diff options
context:
space:
mode:
authornaughtyfox <mail.for.milo@gmail.com>2018-03-21 20:34:15 +0300
committernaughtyfox <mail.for.milo@gmail.com>2018-03-28 16:11:16 +0300
commit47fdb7427357773874c33aac194270caaf46388e (patch)
tree6b5a63f1c8b1d78ed50c9c7ffafbb1de91776b05 /src/wallet/api/wallet.h
parentMerge pull request #3434 (diff)
downloadmonero-47fdb7427357773874c33aac194270caaf46388e.tar.xz
Refactored: work with wallet api statuses to make setting and getting operations atomic along with error strings
WalletApi: added method statusWithErrorString to atomically retrieve error with error string
Diffstat (limited to 'src/wallet/api/wallet.h')
-rw-r--r--src/wallet/api/wallet.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index 4929c9673..7a0526e0a 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -83,6 +83,7 @@ public:
// void setListener(Listener *) {}
int status() const;
std::string errorString() const;
+ void statusWithErrorString(int& status, std::string& errorString) const override;
bool setPassword(const std::string &password);
std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const;
std::string integratedAddress(const std::string &payment_id) const;
@@ -174,6 +175,9 @@ public:
private:
void clearStatus() const;
+ void setStatusError(const std::string& message) const;
+ void setStatusCritical(const std::string& message) const;
+ void setStatus(int status, const std::string& message) const;
void refreshThreadFunc();
void doRefresh();
bool daemonSynced() const;
@@ -191,7 +195,8 @@ private:
friend class SubaddressAccountImpl;
tools::wallet2 * m_wallet;
- mutable std::atomic<int> m_status;
+ mutable boost::mutex m_statusMutex;
+ mutable int m_status;
mutable std::string m_errorString;
std::string m_password;
TransactionHistoryImpl * m_history;