Ticket #13212: condition_variable_test.cpp
| File condition_variable_test.cpp, 336 bytes (added by , 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | |
| 2 | #include <boost/thread/thread.hpp> |
| 3 | |
| 4 | boost::condition_variable x; |
| 5 | |
| 6 | void Wait(); |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | boost::thread t = boost::thread(Wait); |
| 11 | while(true) |
| 12 | x.notify_one(); |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | void Wait() |
| 17 | { |
| 18 | boost::mutex m; |
| 19 | boost::unique_lock<boost::mutex> lock(m); |
| 20 | while(true) |
| 21 | x.wait(lock); |
| 22 | } |
