diff options
Diffstat (limited to 'examples/thread/thread.cc')
-rw-r--r-- | examples/thread/thread.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/thread/thread.cc b/examples/thread/thread.cc index 33c37b8c..e99de76b 100644 --- a/examples/thread/thread.cc +++ b/examples/thread/thread.cc @@ -111,23 +111,21 @@ int main(int, char**) MessageQueue queue; - auto *const producer = new std::thread( + //TODO: Use std::make_unique() when we use C++14: + const auto producer = std::unique_ptr<std::thread>(new std::thread( [&queue] () { queue.producer(); - }); + })); - auto *const consumer = new std::thread( + const auto consumer = std::unique_ptr<std::thread>(new std::thread( [&queue] () { queue.consumer(); - }); + })); producer->join(); - delete producer; - consumer->join(); - delete consumer; std::cout << std::endl; |