I write a simple program for testing Thread in c++11 but std::cout doesnt work as I expect.
std::cout
class Printer { public: void exec() {
You may consider a global std::mutex cout_mutex; (somewhere in your namespaces), which is used to protected std::cout output. Make sure you use std::lock (so you cannot forget to unlock the mutex and for exception safety).
std::mutex cout_mutex;
std::lock