From e054b8128fb6f9a02cea1e29feb1bd8a0b2e1262 Mon Sep 17 00:00:00 2001 From: Valera Cogut Date: Wed, 29 Aug 2018 06:28:00 +0300 Subject: [PATCH] added precompiled directives to beautify code --- programs/cli_wallet/main.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/programs/cli_wallet/main.cpp b/programs/cli_wallet/main.cpp index a64d2d46f2..bf07b29441 100644 --- a/programs/cli_wallet/main.cpp +++ b/programs/cli_wallet/main.cpp @@ -61,6 +61,12 @@ # include #endif +#ifdef WIN32 + #define QUIT_CURR_THREAD TerminateThread(pthread_self(), 0) +#else + #define QUIT_CURR_THREAD pthread_cancel(pthread_self()) +#endif + using namespace graphene::app; using namespace graphene::chain; using namespace graphene::utilities; @@ -283,21 +289,13 @@ 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()); - #ifdef WIN32 - TerminateThread(pthread_self(), 0); - #else - pthread_cancel(pthread_self()); - #endif + QUIT_CURR_THREAD; }, 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()); - #ifdef WIN32 - TerminateThread(pthread_self(), 0); - #else - pthread_cancel(pthread_self()); - #endif + QUIT_CURR_THREAD; }, SIGTERM); wallet_cli->wait();