Figured out hang on Mingw32 - its std::atomic<> isn't threadsafe (yes, really). Now uses boost::atomic<>.