Ticket #12220: future_then_leak.cpp
| File future_then_leak.cpp, 472 bytes (added by , 6 years ago) |
|---|
| Line | |
|---|---|
| 1 | #define BOOST_THREAD_PROVIDES_FUTURE |
| 2 | #define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION |
| 3 | // #define BOOST_THREAD_VERSION 4 |
| 4 | |
| 5 | #include <boost/thread/thread.hpp> |
| 6 | #include <boost/thread/future.hpp> |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | for (long i = 0; i < 10000000; i++) { |
| 11 | boost::promise<void> p; |
| 12 | |
| 13 | auto f = p.get_future().then(boost::launch::async, |
| 14 | [i](boost::future<void> previous) { }); |
| 15 | |
| 16 | p.set_value(); |
| 17 | f.get(); |
| 18 | } |
| 19 | } |
