Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/thread/thread_guard.hpp @ 133:4acb5d8d80b6 tip
Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author | Chris Cannam |
---|---|
date | Tue, 30 Jul 2019 12:25:44 +0100 |
parents | 2665513ce2d3 |
children |
rev | line source |
---|---|
Chris@16 | 1 // Distributed under the Boost Software License, Version 1.0. (See |
Chris@16 | 2 // accompanying file LICENSE_1_0.txt or copy at |
Chris@16 | 3 // http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 4 // (C) Copyright 2009-2012 Anthony Williams |
Chris@16 | 5 // (C) Copyright 2012 Vicente J. Botet Escriba |
Chris@16 | 6 |
Chris@16 | 7 // Based on the Anthony's idea of thread_joiner in CCiA |
Chris@16 | 8 |
Chris@16 | 9 #ifndef BOOST_THREAD_THREAD_GUARD_HPP |
Chris@16 | 10 #define BOOST_THREAD_THREAD_GUARD_HPP |
Chris@16 | 11 |
Chris@16 | 12 #include <boost/thread/detail/delete.hpp> |
Chris@16 | 13 #include <boost/thread/detail/move.hpp> |
Chris@16 | 14 #include <boost/thread/thread_functors.hpp> |
Chris@16 | 15 |
Chris@16 | 16 #include <boost/config/abi_prefix.hpp> |
Chris@16 | 17 |
Chris@16 | 18 namespace boost |
Chris@16 | 19 { |
Chris@16 | 20 |
Chris@16 | 21 /** |
Chris@16 | 22 * Non-copyable RAII scoped thread guard joiner which join the thread if joinable when destroyed. |
Chris@16 | 23 */ |
Chris@16 | 24 template <class CallableThread = join_if_joinable> |
Chris@16 | 25 class thread_guard |
Chris@16 | 26 { |
Chris@16 | 27 thread& t_; |
Chris@16 | 28 public: |
Chris@16 | 29 BOOST_THREAD_NO_COPYABLE( thread_guard) |
Chris@16 | 30 |
Chris@16 | 31 explicit thread_guard(thread& t) : |
Chris@16 | 32 t_(t) |
Chris@16 | 33 { |
Chris@16 | 34 } |
Chris@16 | 35 ~thread_guard() |
Chris@16 | 36 { |
Chris@16 | 37 CallableThread on_destructor; |
Chris@16 | 38 |
Chris@16 | 39 on_destructor(t_); |
Chris@16 | 40 } |
Chris@16 | 41 }; |
Chris@16 | 42 |
Chris@16 | 43 } |
Chris@16 | 44 #include <boost/config/abi_suffix.hpp> |
Chris@16 | 45 |
Chris@16 | 46 #endif |