diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2010-09-03 21:46:37 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2010-09-03 21:46:37 +0000 |
| commit | b77c0c03bb5f48c7ff98aa0d8dd5c648e8a1a651 (patch) | |
| tree | 51b1ae1903851f02fc0104ff07339673c7e83f73 /libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp | |
| parent | 005155e236afd14f9cc1342a213f050287e9bb26 (diff) | |
| download | bcm5719-llvm-b77c0c03bb5f48c7ff98aa0d8dd5c648e8a1a651.tar.gz bcm5719-llvm-b77c0c03bb5f48c7ff98aa0d8dd5c648e8a1a651.zip | |
[futures.atomic_future] and notify_all_at_thread_exit. This completes the header <future> and all of Chapter 30 (for C++0x enabled compilers).
llvm-svn: 113017
Diffstat (limited to 'libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp')
| -rw-r--r-- | libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp b/libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp index 6cc9067effc..6584a7712c2 100644 --- a/libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp +++ b/libcxx/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp @@ -13,9 +13,30 @@ // notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk); #include <condition_variable> +#include <mutex> +#include <thread> +#include <chrono> #include <cassert> +std::condition_variable cv; +std::mutex mut; + +typedef std::chrono::milliseconds ms; +typedef std::chrono::high_resolution_clock Clock; + +void func() +{ + std::unique_lock<std::mutex> lk(mut); + std::notify_all_at_thread_exit(cv, std::move(lk)); + std::this_thread::sleep_for(ms(300)); +} + int main() { -#error notify_all_at_thread_exit not implemented + std::unique_lock<std::mutex> lk(mut); + std::thread(func).detach(); + Clock::time_point t0 = Clock::now(); + cv.wait(lk); + Clock::time_point t1 = Clock::now(); + assert(t1-t0 > ms(250)); } |

