http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58929
Bug ID: 58929 Summary: condition_variable does not wait without -pthread Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lundberj at gmail dot com A warning would have been helpful for this case of missed -pthread. Normally a runtime error is at least generated but the following C++11 code compiles fine with all warnings enabled, and also executes without run time errors, but does so incorrectly if -pthread is not given. (wait_for is then just skipped). cheers Johan. #include <chrono> #include <mutex> #include <condition_variable> void sleep10(){ // sleeps only of -pthread is used std::mutex m; std::condition_variable cv; std::unique_lock<std::mutex> lk(m); cv.wait_for(lk,std::chrono::seconds{10}); }