public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58929] New: condition_variable does not wait without -pthread
@ 2013-10-30 20:10 lundberj at gmail dot com
  2013-10-31 11:29 ` [Bug libstdc++/58929] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: lundberj at gmail dot com @ 2013-10-30 20:10 UTC (permalink / raw)
  To: gcc-bugs

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}); 
}


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-11-23 11:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 20:10 [Bug c++/58929] New: condition_variable does not wait without -pthread lundberj at gmail dot com
2013-10-31 11:29 ` [Bug libstdc++/58929] " redi at gcc dot gnu.org
2013-10-31 11:31 ` redi at gcc dot gnu.org
2013-10-31 16:10 ` lundberj at gmail dot com
2013-10-31 16:18 ` redi at gcc dot gnu.org
2013-10-31 16:20 ` redi at gcc dot gnu.org
2013-10-31 18:40 ` jakub at gcc dot gnu.org
2014-09-19 11:04 ` redi at gcc dot gnu.org
2020-04-18 17:36 ` matare@fh-aachen.de
2020-04-18 19:53 ` redi at gcc dot gnu.org
2020-04-19  0:10 ` matare@fh-aachen.de
2020-11-23 11:05 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).