singal handlers should not use non-reentrant functions such as operators on cout or complex C++ operations, see http://en.cppreference.com/w/cpp/utility/program/signal and https://linux.die.net/man/2/signal.
It would be better to just set the std::atomic in the handler and do all the complex things (cout, stopping the adapter etc.) after the while loop in the main function.