diff --git a/include/fc/thread/thread.hpp b/include/fc/thread/thread.hpp index 282fc30..59545fe 100644 --- a/include/fc/thread/thread.hpp +++ b/include/fc/thread/thread.hpp @@ -131,6 +131,11 @@ namespace fc { * @todo make quit non-blocking of the calling thread by eliminating the call to boost::thread::join */ void quit(); + + /** + * Send signal to underlying native thread. Only for Linux and macOS + */ + void signal(int); /** * @return true unless quit() has been called. diff --git a/src/thread/thread.cpp b/src/thread/thread.cpp index f1c1e99..ef45632 100644 --- a/src/thread/thread.cpp +++ b/src/thread/thread.cpp @@ -156,6 +156,17 @@ namespace fc { void thread::debug( const fc::string& d ) { /*my->debug(d);*/ } +#if defined(__linux__) || defined(__APPLE__) +#include +#endif + + void thread::signal(int sig) + { +#if defined(__linux__) || defined(__APPLE__) + pthread_kill( my->boost_thread->native_handle(), sig ); +#endif + } + void thread::quit() { //if quitting from a different thread, start quit task on thread.