fix clang/gcc warning and error

using std::atomic<bool> hangs in the destructor, waiting infinitely for a thread to terminate...