diff --git a/common/include/eoskeygen/key_search.hpp b/common/include/eoskeygen/key_search.hpp index eb358da..3e3975a 100644 --- a/common/include/eoskeygen/key_search.hpp +++ b/common/include/eoskeygen/key_search.hpp @@ -71,6 +71,12 @@ public : void setThreadCount(size_t num); #endif /* EOSIOKEYGEN_HAVE_THREADS */ + // Aborts find() operation if started. + // This is useful for multithreaded code (like GUI application) + // If find() is started as a seperate thread. This method could be called + // from the gui thread if the user presses "cancel" button. + void abort(); + // Perform a search. void find(size_t num_results); diff --git a/common/src/key_search.cpp b/common/src/key_search.cpp index 68803a9..506ee84 100644 --- a/common/src/key_search.cpp +++ b/common/src/key_search.cpp @@ -83,6 +83,12 @@ void KeySearch::_search_linear() } } +void KeySearch::abort() +{ + // exit find() operation by setting m_max to zero. + m_max = 0; +} + void KeySearch::find(size_t num_results) { m_count = 0;