1
0
Fork 0
forked from lthn/blockchain

fixed bug with deatachment of thread object

This commit is contained in:
cryptozoidberg 2020-02-28 05:37:53 +01:00
parent 1cad3e1925
commit 47e33ff75d
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
2 changed files with 13 additions and 1 deletions

View file

@ -265,7 +265,8 @@ namespace plain_wallet
put_result(job_id, res);
};
}
std::thread([async_callback]() {async_callback(); });
std::thread t([async_callback]() {async_callback(); });
t.detach();
LOG_PRINT_L0("[ASYNC_CALL]: started " << method_name << ", job id: " << job_id);
return job_id;
}

View file

@ -22,6 +22,17 @@ void run_plain_wallet_api_test()
std::string s = plain_wallet::init("195.201.107.230", "11211");
LOG_PRINT_L0("Generating wallet...");
view::open_wallet_request owr = AUTO_VAL_INIT(owr);
owr.path = "E:\\tmp\\zano_testwallet_745ss65030.zan";
owr.pass = "";
uint64_t job_id = plain_wallet::async_call("open", 0, epee::serialization::store_t_to_json(owr));
while (true)
{
std::string res = plain_wallet::try_pull_result(job_id);
LOG_PRINT_L0("[try_pull_result] RESPONSE:" << ENDL << res);
epee::misc_utils::sleep_no_w(1000);
}
std::string rsp = plain_wallet::open(std::string("E:\\tmp\\zano_testwallet_745ss65030.zan"), "");
LOG_PRINT_L0("RESPONSE:" << ENDL << rsp);
epee::json_rpc::response<view::open_wallet_response, epee::json_rpc::dummy_error> ok_response = AUTO_VAL_INIT(ok_response);