aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-09-20 20:08:33 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-09-20 20:08:33 +0300
commitcdb6c96f891e79178d4237ae0b108be1070289bb (patch)
tree991b46dd89e8e1601a6f6831680e256764321135 /src
parentMerge pull request #1102 (diff)
downloadmonero-cdb6c96f891e79178d4237ae0b108be1070289bb.tar.xz
wallet2_api: fixed deadlock while closing wallet
Diffstat (limited to 'src')
-rw-r--r--src/wallet/api/wallet.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 74552bc03..9ecc931ad 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -169,7 +169,9 @@ WalletImpl::WalletImpl(bool testnet)
m_wallet->callback(m_wallet2Callback);
m_refreshThreadDone = false;
m_refreshEnabled = false;
+
m_refreshIntervalSeconds = DEFAULT_REFRESH_INTERVAL_SECONDS;
+
m_refreshThread = boost::thread([this] () {
this->refreshThreadFunc();
});
@@ -272,14 +274,15 @@ bool WalletImpl::close()
{
bool result = false;
+ LOG_PRINT_L3("closing wallet...");
try {
// do not store wallet with invalid status
if (status() == Status_Ok)
m_wallet->store();
- // LOG_PRINT_L0("wallet::store done");
- // LOG_PRINT_L0("Calling wallet::stop...");
+ LOG_PRINT_L3("wallet::store done");
+ LOG_PRINT_L3("Calling wallet::stop...");
m_wallet->stop();
- // LOG_PRINT_L0("wallet::stop done");
+ LOG_PRINT_L3("wallet::stop done");
result = true;
clearStatus();
} catch (const std::exception &e) {
@@ -680,6 +683,7 @@ void WalletImpl::stopRefresh()
if (!m_refreshThreadDone) {
m_refreshEnabled = false;
m_refreshThreadDone = true;
+ m_refreshCV.notify_one();
m_refreshThread.join();
}
}