https://llvm.org/bugs/show_bug.cgi?id=30376
Bug ID: 30376 Summary: std::promise/future deadlock Product: libc++ Version: unspecified Hardware: Macintosh OS: MacOS X Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedclangb...@nondot.org Reporter: v...@mixedrealities.no CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com Classification: Unclassified The bug happens with "Apple LLVM 7.0.0" (clang 7) on OSX 10.11.1 (El Capitan) with XCode 7.0.1. The program below will write out a series of numbers and after a short while hang, whereas it shouldn't. It runs flawlessly on Linux. #include <iostream> #include <thread> #include <future> #include <boost/asio.hpp> using std::cout; using std::endl; static boost::asio::io_service io; static void asio_thread() { boost::asio::io_service::work work(io); cout << "STARTING ASIO" << endl; io.run(); cout << "STOPPING ASIO" << endl; } static int poll() { static int n; std::promise<int> promise; auto fut = promise.get_future(); io.post([&promise]() { promise.set_value(n++); }); return fut.get(); } int main() { std::thread thread(asio_thread); size_t n = 0; while (1) cout << "POLL: " << poll() << "\n"; return 0; } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs