Skip to content

Commit

Permalink
cancel thread instead of termination
Browse files Browse the repository at this point in the history
  • Loading branch information
cogutvalera committed Aug 28, 2018
1 parent ac3ff0a commit 7ae6527
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions programs/cli_wallet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,21 @@ int main( int argc, char** argv )
fc::set_signal_handler([&wapi, &wallet_file](int signal) {
ilog( "Captured SIGINT not in daemon mode" );
wapi->save_wallet_file(wallet_file.generic_string());
std::terminate();
#ifdef WIN32
TerminateThread(pthread_self(), 0);
#else
pthread_cancel(pthread_self());
#endif
}, SIGINT);

fc::set_signal_handler([&wapi, &wallet_file](int signal) {
ilog( "Captured SIGTERM not in daemon mode" );
wapi->save_wallet_file(wallet_file.generic_string());
std::terminate();
#ifdef WIN32
TerminateThread(pthread_self(), 0);
#else
pthread_cancel(pthread_self());
#endif
}, SIGTERM);

wallet_cli->wait();
Expand Down

0 comments on commit 7ae6527

Please sign in to comment.