16 #ifndef dealii__thread_management_h 17 #define dealii__thread_management_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/base/template_constraints.h> 23 #include <deal.II/base/std_cxx11/tuple.h> 24 #include <deal.II/base/std_cxx11/function.h> 25 #include <deal.II/base/std_cxx11/shared_ptr.h> 26 #include <deal.II/base/std_cxx11/bind.h> 28 #ifdef DEAL_II_WITH_THREADS 29 # include <deal.II/base/std_cxx11/thread.h> 30 # include <deal.II/base/std_cxx11/mutex.h> 31 # include <deal.II/base/std_cxx11/condition_variable.h> 40 #ifdef DEAL_II_WITH_THREADS 41 # ifdef DEAL_II_USE_MT_POSIX 44 # include <tbb/task.h> 49 DEAL_II_NAMESPACE_OPEN
195 const char *name = 0,
222 <<
"In single-thread mode, barrier sizes other than 1 are not " 223 <<
"useful. You gave " << arg1 <<
".");
229 #ifdef DEAL_II_WITH_THREADS 352 condition_variable.notify_one();
361 condition_variable.notify_all();
375 std_cxx11::unique_lock<std_cxx11::mutex> lock(mutex.
mutex,
376 std_cxx11::adopt_lock);
377 condition_variable.wait (lock);
410 const char *name = 0,
431 #ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS 532 template <
typename ForwardIterator>
533 std::vector<std::pair<ForwardIterator,ForwardIterator> >
535 const ForwardIterator &end,
536 const unsigned int n_intervals);
546 std::vector<std::pair<unsigned int,unsigned int> >
548 const unsigned int end,
549 const unsigned int n_intervals);
579 void handle_std_exception (
const std::exception &exc);
588 void handle_unknown_exception ();
597 void register_thread ();
606 void deregister_thread ();
619 template <
typename ForwardIterator>
620 std::vector<std::pair<ForwardIterator,ForwardIterator> >
622 const ForwardIterator &end,
623 const unsigned int n_intervals)
625 typedef std::pair<ForwardIterator,ForwardIterator> IteratorPair;
632 return (std::vector<IteratorPair>
633 (1, IteratorPair(begin, end)));
636 const unsigned int n_elements = std::distance (begin, end);
637 const unsigned int n_elements_per_interval = n_elements / n_intervals;
638 const unsigned int residual = n_elements % n_intervals;
640 std::vector<IteratorPair> return_values (n_intervals);
642 return_values[0].first = begin;
643 for (
unsigned int i=0; i<n_intervals; ++i)
645 if (i != n_intervals-1)
647 return_values[i].second = return_values[i].first;
652 std::advance (return_values[i].second,
653 static_cast<signed int>(n_elements_per_interval));
657 ++return_values[i].second;
659 return_values[i+1].first = return_values[i].second;
662 return_values[i].second = end;
664 return return_values;
681 template <
typename RT>
struct return_value
686 inline return_value () : value() {}
688 inline RT
get ()
const 693 inline void set (RT v)
709 template <
typename RT>
struct return_value<RT &>
714 inline return_value () : value(0) {}
716 inline RT &
get ()
const 720 inline void set (RT &v)
735 template <>
struct return_value<void>
737 static inline void get () {}
745 template <
typename RT>
746 inline void call (
const std_cxx11::function<RT ()> &
function,
747 internal::return_value<RT> &ret_val)
749 ret_val.set (
function());
753 inline void call (
const std_cxx11::function<
void ()> &
function,
754 internal::return_value<void> &)
773 template <
typename RT,
typename ArgList,
774 int length = std_cxx11::tuple_size<ArgList>::value>
775 struct fun_ptr_helper;
784 template <
typename RT,
typename ArgList>
785 struct fun_ptr_helper<RT, ArgList, 0>
787 typedef RT (type) ();
797 template <
typename RT,
typename ArgList>
798 struct fun_ptr_helper<RT, ArgList, 1>
800 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type);
810 template <
typename RT,
typename ArgList>
811 struct fun_ptr_helper<RT, ArgList, 2>
813 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
814 typename std_cxx11::tuple_element<1,ArgList>::type);
824 template <
typename RT,
typename ArgList>
825 struct fun_ptr_helper<RT, ArgList, 3>
827 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
828 typename std_cxx11::tuple_element<1,ArgList>::type,
829 typename std_cxx11::tuple_element<2,ArgList>::type);
839 template <
typename RT,
typename ArgList>
840 struct fun_ptr_helper<RT, ArgList, 4>
842 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
843 typename std_cxx11::tuple_element<1,ArgList>::type,
844 typename std_cxx11::tuple_element<2,ArgList>::type,
845 typename std_cxx11::tuple_element<3,ArgList>::type);
855 template <
typename RT,
typename ArgList>
856 struct fun_ptr_helper<RT, ArgList, 5>
858 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
859 typename std_cxx11::tuple_element<1,ArgList>::type,
860 typename std_cxx11::tuple_element<2,ArgList>::type,
861 typename std_cxx11::tuple_element<3,ArgList>::type,
862 typename std_cxx11::tuple_element<4,ArgList>::type);
872 template <
typename RT,
typename ArgList>
873 struct fun_ptr_helper<RT, ArgList, 6>
875 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
876 typename std_cxx11::tuple_element<1,ArgList>::type,
877 typename std_cxx11::tuple_element<2,ArgList>::type,
878 typename std_cxx11::tuple_element<3,ArgList>::type,
879 typename std_cxx11::tuple_element<4,ArgList>::type,
880 typename std_cxx11::tuple_element<5,ArgList>::type);
890 template <
typename RT,
typename ArgList>
891 struct fun_ptr_helper<RT, ArgList, 7>
893 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
894 typename std_cxx11::tuple_element<1,ArgList>::type,
895 typename std_cxx11::tuple_element<2,ArgList>::type,
896 typename std_cxx11::tuple_element<3,ArgList>::type,
897 typename std_cxx11::tuple_element<4,ArgList>::type,
898 typename std_cxx11::tuple_element<5,ArgList>::type,
899 typename std_cxx11::tuple_element<6,ArgList>::type);
909 template <
typename RT,
typename ArgList>
910 struct fun_ptr_helper<RT, ArgList, 8>
912 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
913 typename std_cxx11::tuple_element<1,ArgList>::type,
914 typename std_cxx11::tuple_element<2,ArgList>::type,
915 typename std_cxx11::tuple_element<3,ArgList>::type,
916 typename std_cxx11::tuple_element<4,ArgList>::type,
917 typename std_cxx11::tuple_element<5,ArgList>::type,
918 typename std_cxx11::tuple_element<6,ArgList>::type,
919 typename std_cxx11::tuple_element<7,ArgList>::type);
929 template <
typename RT,
typename ArgList>
930 struct fun_ptr_helper<RT, ArgList, 9>
932 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
933 typename std_cxx11::tuple_element<1,ArgList>::type,
934 typename std_cxx11::tuple_element<2,ArgList>::type,
935 typename std_cxx11::tuple_element<3,ArgList>::type,
936 typename std_cxx11::tuple_element<4,ArgList>::type,
937 typename std_cxx11::tuple_element<5,ArgList>::type,
938 typename std_cxx11::tuple_element<6,ArgList>::type,
939 typename std_cxx11::tuple_element<7,ArgList>::type,
940 typename std_cxx11::tuple_element<8,ArgList>::type);
951 template <
typename RT,
typename ArgList>
952 struct fun_ptr_helper<RT, ArgList, 10>
954 typedef RT (type) (
typename std_cxx11::tuple_element<0,ArgList>::type,
955 typename std_cxx11::tuple_element<1,ArgList>::type,
956 typename std_cxx11::tuple_element<2,ArgList>::type,
957 typename std_cxx11::tuple_element<3,ArgList>::type,
958 typename std_cxx11::tuple_element<4,ArgList>::type,
959 typename std_cxx11::tuple_element<5,ArgList>::type,
960 typename std_cxx11::tuple_element<6,ArgList>::type,
961 typename std_cxx11::tuple_element<7,ArgList>::type,
962 typename std_cxx11::tuple_element<8,ArgList>::type,
963 typename std_cxx11::tuple_element<9,ArgList>::type);
978 template <
typename RT,
typename ArgList>
981 typedef typename fun_ptr_helper<RT,ArgList>::type type;
989 #ifdef DEAL_II_WITH_THREADS 1001 template <
typename RT>
1062 thread_is_active (false)
1067 if (!thread_is_active)
1070 thread_is_active =
false;
1077 void start (
const std_cxx11::function<RT ()> &
function)
1079 thread_is_active =
true;
1080 ret_val.reset(
new return_value<RT>());
1081 thread = std_cxx11::thread (thread_entry_point,
function, ret_val);
1093 if (thread_is_active ==
false)
1097 if (thread_is_active ==
true)
1099 Assert (thread.joinable(), ExcInternalError());
1101 thread_is_active =
false;
1112 std_cxx11::shared_ptr<return_value<RT> > ret_val)
1119 internal::register_thread ();
1122 call (
function, *ret_val);
1124 catch (
const std::exception &exc)
1126 internal::handle_std_exception (exc);
1130 internal::handle_unknown_exception ();
1132 internal::deregister_thread ();
1145 template <
typename RT>
1152 std_cxx11::shared_ptr<return_value<RT> > ret_val;
1158 void start (
const std_cxx11::function<RT ()> &
function)
1160 ret_val.reset(
new return_value<RT>());
1161 call (
function, *ret_val);
1197 template <
typename RT =
void>
1204 Thread (
const std_cxx11::function<RT ()> &
function)
1206 thread_descriptor (new
internal::ThreadDescriptor<RT>())
1209 thread_descriptor->start (
function);
1224 thread_descriptor (t.thread_descriptor)
1234 if (thread_descriptor)
1235 thread_descriptor->join ();
1245 return thread_descriptor->ret_val->get();
1254 return static_cast<bool>(thread_descriptor);
1288 template <
typename T>
1306 template <
typename T>
1309 static std_cxx11::reference_wrapper<T> act (T &t)
1311 return std_cxx11::ref(t);
1333 template <
typename RT,
typename ArgList,
int length>
1334 class fun_encapsulator;
1344 template <
typename RT,
typename ArgList>
1345 class fun_encapsulator<RT, ArgList, 0>
1348 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1349 :
function (*function)
1352 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1353 :
function (
function)
1364 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1372 template <
typename RT,
typename ArgList>
1373 class fun_encapsulator<RT, ArgList, 1>
1376 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1377 :
function (*function)
1380 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1381 :
function (
function)
1386 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1)
1390 (std_cxx11::bind (
function,
1395 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1403 template <
typename RT,
typename ArgList>
1404 class fun_encapsulator<RT, ArgList, 2>
1407 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1408 :
function (*function)
1411 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1412 :
function (
function)
1417 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1418 typename std_cxx11::tuple_element<1,ArgList>::type arg2)
1422 (std_cxx11::bind (
function,
1428 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1436 template <
typename RT,
typename ArgList>
1437 class fun_encapsulator<RT, ArgList, 3>
1440 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1441 :
function (*function)
1444 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1445 :
function (
function)
1450 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1451 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1452 typename std_cxx11::tuple_element<2,ArgList>::type arg3)
1456 (std_cxx11::bind (
function,
1463 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1471 template <
typename RT,
typename ArgList>
1472 class fun_encapsulator<RT, ArgList, 4>
1475 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1476 :
function (*function)
1479 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1480 :
function (
function)
1485 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1486 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1487 typename std_cxx11::tuple_element<2,ArgList>::type arg3,
1488 typename std_cxx11::tuple_element<3,ArgList>::type arg4)
1492 (std_cxx11::bind (
function,
1500 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1508 template <
typename RT,
typename ArgList>
1509 class fun_encapsulator<RT, ArgList, 5>
1512 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1513 :
function (*function)
1516 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1517 :
function (
function)
1522 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1523 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1524 typename std_cxx11::tuple_element<2,ArgList>::type arg3,
1525 typename std_cxx11::tuple_element<3,ArgList>::type arg4,
1526 typename std_cxx11::tuple_element<4,ArgList>::type arg5)
1530 (std_cxx11::bind (
function,
1539 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1547 template <
typename RT,
typename ArgList>
1548 class fun_encapsulator<RT, ArgList, 6>
1551 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1552 :
function (*function)
1555 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1556 :
function (
function)
1561 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1562 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1563 typename std_cxx11::tuple_element<2,ArgList>::type arg3,
1564 typename std_cxx11::tuple_element<3,ArgList>::type arg4,
1565 typename std_cxx11::tuple_element<4,ArgList>::type arg5,
1566 typename std_cxx11::tuple_element<5,ArgList>::type arg6)
1570 (std_cxx11::bind (
function,
1580 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1588 template <
typename RT,
typename ArgList>
1589 class fun_encapsulator<RT, ArgList, 7>
1592 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1593 :
function (*function)
1596 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1597 :
function (
function)
1602 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1603 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1604 typename std_cxx11::tuple_element<2,ArgList>::type arg3,
1605 typename std_cxx11::tuple_element<3,ArgList>::type arg4,
1606 typename std_cxx11::tuple_element<4,ArgList>::type arg5,
1607 typename std_cxx11::tuple_element<5,ArgList>::type arg6,
1608 typename std_cxx11::tuple_element<6,ArgList>::type arg7)
1612 (std_cxx11::bind (
function,
1623 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1631 template <
typename RT,
typename ArgList>
1632 class fun_encapsulator<RT, ArgList, 8>
1635 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1636 :
function (*function)
1639 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1640 :
function (
function)
1645 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1646 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1647 typename std_cxx11::tuple_element<2,ArgList>::type arg3,
1648 typename std_cxx11::tuple_element<3,ArgList>::type arg4,
1649 typename std_cxx11::tuple_element<4,ArgList>::type arg5,
1650 typename std_cxx11::tuple_element<5,ArgList>::type arg6,
1651 typename std_cxx11::tuple_element<6,ArgList>::type arg7,
1652 typename std_cxx11::tuple_element<7,ArgList>::type arg8)
1656 (std_cxx11::bind (
function,
1668 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1676 template <
typename RT,
typename ArgList>
1677 class fun_encapsulator<RT, ArgList, 9>
1680 fun_encapsulator (
typename internal::fun_ptr<RT,ArgList>::type *
function)
1681 :
function (*function)
1684 fun_encapsulator (
const std_cxx11::function<
typename internal::fun_ptr<RT,ArgList>::type> &
function)
1685 :
function (
function)
1690 operator() (
typename std_cxx11::tuple_element<0,ArgList>::type arg1,
1691 typename std_cxx11::tuple_element<1,ArgList>::type arg2,
1692 typename std_cxx11::tuple_element<2,ArgList>::type arg3,
1693 typename std_cxx11::tuple_element<3,ArgList>::type arg4,
1694 typename std_cxx11::tuple_element<4,ArgList>::type arg5,
1695 typename std_cxx11::tuple_element<5,ArgList>::type arg6,
1696 typename std_cxx11::tuple_element<6,ArgList>::type arg7,
1697 typename std_cxx11::tuple_element<7,ArgList>::type arg8,
1698 typename std_cxx11::tuple_element<8,ArgList>::type arg9)
1702 (std_cxx11::bind (
function,
1715 std_cxx11::function<typename internal::fun_ptr<RT,ArgList>::type>
function;
1731 template <
typename RT>
1745 template <
typename RT>
1760 template <
typename RT,
typename C>
1764 typename identity<C>::type &c)
1768 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c)));
1772 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 1779 template <
typename RT,
typename C>
1783 const typename identity<C>::type &c)
1787 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c)));
1801 template <
typename RT,
typename Arg1>
1805 typename identity<Arg1>::type arg1)
1809 (std_cxx11::bind(fun_ptr,
1821 template <
typename RT,
typename C,
typename Arg1>
1825 typename identity<C>::type &c,
1826 typename identity<Arg1>::type arg1)
1830 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
1834 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 1841 template <
typename RT,
typename C,
typename Arg1>
1845 typename identity<const C>::type &c,
1846 typename identity<Arg1>::type arg1)
1850 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
1863 template <
typename RT,
typename Arg1,
typename Arg2>
1867 typename identity<Arg1>::type arg1,
1868 typename identity<Arg2>::type arg2)
1872 (std_cxx11::bind(fun_ptr,
1885 template <
typename RT,
typename C,
typename Arg1,
typename Arg2>
1889 typename identity<C>::type &c,
1890 typename identity<Arg1>::type arg1,
1891 typename identity<Arg2>::type arg2)
1895 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
1900 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 1907 template <
typename RT,
typename C,
typename Arg1,
typename Arg2>
1911 typename identity<const C>::type &c,
1912 typename identity<Arg1>::type arg1,
1913 typename identity<Arg2>::type arg2)
1917 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
1931 template <
typename RT,
1932 typename Arg1,
typename Arg2,
typename Arg3>
1936 typename identity<Arg1>::type arg1,
1937 typename identity<Arg2>::type arg2,
1938 typename identity<Arg3>::type arg3)
1942 (std_cxx11::bind(fun_ptr,
1956 template <
typename RT,
typename C,
1957 typename Arg1,
typename Arg2,
typename Arg3>
1961 typename identity<C>::type &c,
1962 typename identity<Arg1>::type arg1,
1963 typename identity<Arg2>::type arg2,
1964 typename identity<Arg3>::type arg3)
1968 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
1974 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 1981 template <
typename RT,
typename C,
1982 typename Arg1,
typename Arg2,
typename Arg3>
1986 typename identity<const C>::type &c,
1987 typename identity<Arg1>::type arg1,
1988 typename identity<Arg2>::type arg2,
1989 typename identity<Arg3>::type arg3)
1993 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2009 template <
typename RT,
2010 typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
2014 typename identity<Arg1>::type arg1,
2015 typename identity<Arg2>::type arg2,
2016 typename identity<Arg3>::type arg3,
2017 typename identity<Arg4>::type arg4)
2021 (std_cxx11::bind(fun_ptr,
2036 template <
typename RT,
typename C,
2037 typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
2041 typename identity<C>::type &c,
2042 typename identity<Arg1>::type arg1,
2043 typename identity<Arg2>::type arg2,
2044 typename identity<Arg3>::type arg3,
2045 typename identity<Arg4>::type arg4)
2049 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
2056 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 2063 template <
typename RT,
typename C,
2064 typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
2068 typename identity<const C>::type &c,
2069 typename identity<Arg1>::type arg1,
2070 typename identity<Arg2>::type arg2,
2071 typename identity<Arg3>::type arg3,
2072 typename identity<Arg4>::type arg4)
2076 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2092 template <
typename RT,
2093 typename Arg1,
typename Arg2,
typename Arg3,
2094 typename Arg4,
typename Arg5>
2098 typename identity<Arg1>::type arg1,
2099 typename identity<Arg2>::type arg2,
2100 typename identity<Arg3>::type arg3,
2101 typename identity<Arg4>::type arg4,
2102 typename identity<Arg5>::type arg5)
2106 (std_cxx11::bind(fun_ptr,
2122 template <
typename RT,
typename C,
2123 typename Arg1,
typename Arg2,
typename Arg3,
2124 typename Arg4,
typename Arg5>
2128 typename identity<C>::type &c,
2129 typename identity<Arg1>::type arg1,
2130 typename identity<Arg2>::type arg2,
2131 typename identity<Arg3>::type arg3,
2132 typename identity<Arg4>::type arg4,
2133 typename identity<Arg5>::type arg5)
2137 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
2145 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 2152 template <
typename RT,
typename C,
2153 typename Arg1,
typename Arg2,
typename Arg3,
2154 typename Arg4,
typename Arg5>
2158 typename identity<const C>::type &c,
2159 typename identity<Arg1>::type arg1,
2160 typename identity<Arg2>::type arg2,
2161 typename identity<Arg3>::type arg3,
2162 typename identity<Arg4>::type arg4,
2163 typename identity<Arg5>::type arg5)
2167 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2184 template <
typename RT,
2185 typename Arg1,
typename Arg2,
typename Arg3,
2186 typename Arg4,
typename Arg5,
typename Arg6>
2190 typename identity<Arg1>::type arg1,
2191 typename identity<Arg2>::type arg2,
2192 typename identity<Arg3>::type arg3,
2193 typename identity<Arg4>::type arg4,
2194 typename identity<Arg5>::type arg5,
2195 typename identity<Arg6>::type arg6)
2199 (std_cxx11::bind(fun_ptr,
2216 template <
typename RT,
typename C,
2217 typename Arg1,
typename Arg2,
typename Arg3,
2218 typename Arg4,
typename Arg5,
typename Arg6>
2222 typename identity<C>::type &c,
2223 typename identity<Arg1>::type arg1,
2224 typename identity<Arg2>::type arg2,
2225 typename identity<Arg3>::type arg3,
2226 typename identity<Arg4>::type arg4,
2227 typename identity<Arg5>::type arg5,
2228 typename identity<Arg6>::type arg6)
2232 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
2241 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 2248 template <
typename RT,
typename C,
2249 typename Arg1,
typename Arg2,
typename Arg3,
2250 typename Arg4,
typename Arg5,
typename Arg6>
2253 new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6)
const,
2254 typename identity<const C>::type &c,
2255 typename identity<Arg1>::type arg1,
2256 typename identity<Arg2>::type arg2,
2257 typename identity<Arg3>::type arg3,
2258 typename identity<Arg4>::type arg4,
2259 typename identity<Arg5>::type arg5,
2260 typename identity<Arg6>::type arg6)
2264 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2282 template <
typename RT,
2283 typename Arg1,
typename Arg2,
typename Arg3,
2284 typename Arg4,
typename Arg5,
typename Arg6,
2289 typename identity<Arg1>::type arg1,
2290 typename identity<Arg2>::type arg2,
2291 typename identity<Arg3>::type arg3,
2292 typename identity<Arg4>::type arg4,
2293 typename identity<Arg5>::type arg5,
2294 typename identity<Arg6>::type arg6,
2295 typename identity<Arg7>::type arg7)
2299 (std_cxx11::bind(fun_ptr,
2317 template <
typename RT,
typename C,
2318 typename Arg1,
typename Arg2,
typename Arg3,
2319 typename Arg4,
typename Arg5,
typename Arg6,
2323 new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7),
2324 typename identity<C>::type &c,
2325 typename identity<Arg1>::type arg1,
2326 typename identity<Arg2>::type arg2,
2327 typename identity<Arg3>::type arg3,
2328 typename identity<Arg4>::type arg4,
2329 typename identity<Arg5>::type arg5,
2330 typename identity<Arg6>::type arg6,
2331 typename identity<Arg7>::type arg7)
2335 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
2345 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 2352 template <
typename RT,
typename C,
2353 typename Arg1,
typename Arg2,
typename Arg3,
2354 typename Arg4,
typename Arg5,
typename Arg6,
2358 new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)
const,
2359 typename identity<const C>::type &c,
2360 typename identity<Arg1>::type arg1,
2361 typename identity<Arg2>::type arg2,
2362 typename identity<Arg3>::type arg3,
2363 typename identity<Arg4>::type arg4,
2364 typename identity<Arg5>::type arg5,
2365 typename identity<Arg6>::type arg6,
2366 typename identity<Arg7>::type arg7)
2370 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2389 template <
typename RT,
2390 typename Arg1,
typename Arg2,
typename Arg3,
2391 typename Arg4,
typename Arg5,
typename Arg6,
2392 typename Arg7,
typename Arg8>
2397 typename identity<Arg1>::type arg1,
2398 typename identity<Arg2>::type arg2,
2399 typename identity<Arg3>::type arg3,
2400 typename identity<Arg4>::type arg4,
2401 typename identity<Arg5>::type arg5,
2402 typename identity<Arg6>::type arg6,
2403 typename identity<Arg7>::type arg7,
2404 typename identity<Arg8>::type arg8)
2408 (std_cxx11::bind(fun_ptr,
2427 template <
typename RT,
typename C,
2428 typename Arg1,
typename Arg2,
typename Arg3,
2429 typename Arg4,
typename Arg5,
typename Arg6,
2430 typename Arg7,
typename Arg8>
2435 typename identity<C>::type &c,
2436 typename identity<Arg1>::type arg1,
2437 typename identity<Arg2>::type arg2,
2438 typename identity<Arg3>::type arg3,
2439 typename identity<Arg4>::type arg4,
2440 typename identity<Arg5>::type arg5,
2441 typename identity<Arg6>::type arg6,
2442 typename identity<Arg7>::type arg7,
2443 typename identity<Arg8>::type arg8)
2447 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
2458 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 2465 template <
typename RT,
typename C,
2466 typename Arg1,
typename Arg2,
typename Arg3,
2467 typename Arg4,
typename Arg5,
typename Arg6,
2468 typename Arg7,
typename Arg8>
2472 Arg6,Arg7,Arg8)
const,
2473 typename identity<const C>::type &c,
2474 typename identity<Arg1>::type arg1,
2475 typename identity<Arg2>::type arg2,
2476 typename identity<Arg3>::type arg3,
2477 typename identity<Arg4>::type arg4,
2478 typename identity<Arg5>::type arg5,
2479 typename identity<Arg6>::type arg6,
2480 typename identity<Arg7>::type arg7,
2481 typename identity<Arg8>::type arg8)
2485 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2505 template <
typename RT,
2506 typename Arg1,
typename Arg2,
typename Arg3,
2507 typename Arg4,
typename Arg5,
typename Arg6,
2508 typename Arg7,
typename Arg8,
typename Arg9>
2512 Arg6,Arg7,Arg8,Arg9),
2513 typename identity<Arg1>::type arg1,
2514 typename identity<Arg2>::type arg2,
2515 typename identity<Arg3>::type arg3,
2516 typename identity<Arg4>::type arg4,
2517 typename identity<Arg5>::type arg5,
2518 typename identity<Arg6>::type arg6,
2519 typename identity<Arg7>::type arg7,
2520 typename identity<Arg8>::type arg8,
2521 typename identity<Arg9>::type arg9)
2525 (std_cxx11::bind(fun_ptr,
2545 template <
typename RT,
typename C,
2546 typename Arg1,
typename Arg2,
typename Arg3,
2547 typename Arg4,
typename Arg5,
typename Arg6,
2548 typename Arg7,
typename Arg8,
typename Arg9>
2552 Arg6,Arg7,Arg8,Arg9),
2553 typename identity<C>::type &c,
2554 typename identity<Arg1>::type arg1,
2555 typename identity<Arg2>::type arg2,
2556 typename identity<Arg3>::type arg3,
2557 typename identity<Arg4>::type arg4,
2558 typename identity<Arg5>::type arg5,
2559 typename identity<Arg6>::type arg6,
2560 typename identity<Arg7>::type arg7,
2561 typename identity<Arg8>::type arg8,
2562 typename identity<Arg9>::type arg9)
2566 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
2578 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 2585 template <
typename RT,
typename C,
2586 typename Arg1,
typename Arg2,
typename Arg3,
2587 typename Arg4,
typename Arg5,
typename Arg6,
2588 typename Arg7,
typename Arg8,
typename Arg9>
2592 Arg6,Arg7,Arg8,Arg9)
const,
2593 typename identity<const C>::type &c,
2594 typename identity<Arg1>::type arg1,
2595 typename identity<Arg2>::type arg2,
2596 typename identity<Arg3>::type arg3,
2597 typename identity<Arg4>::type arg4,
2598 typename identity<Arg5>::type arg5,
2599 typename identity<Arg6>::type arg6,
2600 typename identity<Arg7>::type arg7,
2601 typename identity<Arg8>::type arg8,
2602 typename identity<Arg9>::type arg9)
2606 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
2629 template <
typename RT =
void>
2638 threads.push_back (t);
2650 for (
typename std::list<
Thread<RT> >::const_iterator
2651 t=threads.begin(); t!=threads.end(); ++t)
2668 #ifdef DEAL_II_WITH_THREADS 2670 template <
typename>
struct TaskDescriptor;
2675 template <
typename RT>
2680 task_descriptor (task_descriptor)
2683 virtual tbb::task *execute ()
2689 call (task_descriptor.function, task_descriptor.ret_val);
2691 catch (
const std::exception &exc)
2693 internal::handle_std_exception (exc);
2697 internal::handle_unknown_exception ();
2729 template <
typename RT>
2730 struct TaskDescriptor
2736 std_cxx11::function<RT ()>
function;
2751 return_value<RT> ret_val;
2763 TaskDescriptor (
const std_cxx11::function<RT ()> &
function);
2776 TaskDescriptor (
const TaskDescriptor &);
2800 friend class ::Threads::Task<RT>;
2805 template <
typename RT>
2807 TaskDescriptor<RT>::TaskDescriptor (
const std_cxx11::function<RT ()> &
function)
2809 function (
function),
2810 task_is_done (
false)
2814 template <
typename RT>
2817 TaskDescriptor<RT>::queue_task ()
2821 task =
new (tbb::task::allocate_root()) tbb::empty_task;
2822 task->set_ref_count (2);
2825 task->spawn (*worker);
2830 template <
typename RT>
2831 TaskDescriptor<RT>::TaskDescriptor ()
2833 Assert (
false, ExcInternalError());
2838 template <
typename RT>
2839 TaskDescriptor<RT>::TaskDescriptor (
const TaskDescriptor &)
2841 Assert (
false, ExcInternalError());
2846 template <
typename RT>
2848 TaskDescriptor<RT>::~TaskDescriptor ()
2863 Assert (task != 0, ExcInternalError());
2864 Assert (task->ref_count()==0, ExcInternalError());
2865 task->destroy (*task);
2869 template <
typename RT>
2872 TaskDescriptor<RT>::join ()
2883 if (task_is_done ==
true)
2887 task_is_done =
true;
2888 task->wait_for_all();
2893 #else // no threading enabled 2899 template <
typename RT>
2900 struct TaskDescriptor
2905 return_value<RT> ret_val;
2911 TaskDescriptor (
const std_cxx11::function<RT ()> &
function)
2913 call (
function, ret_val);
2920 static void join () {}
2926 static void queue_task () {}
2945 template <
typename RT =
void>
2956 Task (
const std_cxx11::function<RT ()> &function_object)
2960 task_descriptor.reset (
new internal::TaskDescriptor<RT>(function_object));
2961 task_descriptor->queue_task ();
2973 task_descriptor (t.task_descriptor)
3001 task_descriptor->join ();
3018 return (task_descriptor !=
3019 std_cxx11::shared_ptr<internal::TaskDescriptor<RT> >());
3036 return task_descriptor->ret_val.get();
3060 "The current object is not associated with a task that " 3061 "can be joined. It may have been detached, or you " 3062 "may have already joined it in the past.");
3083 template <
typename RT>
3097 template <
typename RT>
3102 return new_task<RT>(std_cxx11::function<RT ()>(fun_ptr));
3112 template <
typename RT,
typename C>
3116 typename identity<C>::type &c)
3120 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c)));
3123 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3130 template <
typename RT,
typename C>
3134 const typename identity<C>::type &c)
3138 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c)));
3152 template <
typename RT,
typename Arg1>
3156 typename identity<Arg1>::type arg1)
3160 (std_cxx11::bind(fun_ptr,
3172 template <
typename RT,
typename C,
typename Arg1>
3176 typename identity<C>::type &c,
3177 typename identity<Arg1>::type arg1)
3181 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3185 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3192 template <
typename RT,
typename C,
typename Arg1>
3196 typename identity<const C>::type &c,
3197 typename identity<Arg1>::type arg1)
3201 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3214 template <
typename RT,
typename Arg1,
typename Arg2>
3218 typename identity<Arg1>::type arg1,
3219 typename identity<Arg2>::type arg2)
3223 (std_cxx11::bind(fun_ptr,
3236 template <
typename RT,
typename C,
typename Arg1,
typename Arg2>
3240 typename identity<C>::type &c,
3241 typename identity<Arg1>::type arg1,
3242 typename identity<Arg2>::type arg2)
3246 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3251 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3258 template <
typename RT,
typename C,
typename Arg1,
typename Arg2>
3262 typename identity<const C>::type &c,
3263 typename identity<Arg1>::type arg1,
3264 typename identity<Arg2>::type arg2)
3268 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3282 template <
typename RT,
3283 typename Arg1,
typename Arg2,
typename Arg3>
3287 typename identity<Arg1>::type arg1,
3288 typename identity<Arg2>::type arg2,
3289 typename identity<Arg3>::type arg3)
3293 (std_cxx11::bind(fun_ptr,
3307 template <
typename RT,
typename C,
3308 typename Arg1,
typename Arg2,
typename Arg3>
3312 typename identity<C>::type &c,
3313 typename identity<Arg1>::type arg1,
3314 typename identity<Arg2>::type arg2,
3315 typename identity<Arg3>::type arg3)
3319 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3325 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3332 template <
typename RT,
typename C,
3333 typename Arg1,
typename Arg2,
typename Arg3>
3337 typename identity<const C>::type &c,
3338 typename identity<Arg1>::type arg1,
3339 typename identity<Arg2>::type arg2,
3340 typename identity<Arg3>::type arg3)
3344 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3360 template <
typename RT,
3361 typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
3365 typename identity<Arg1>::type arg1,
3366 typename identity<Arg2>::type arg2,
3367 typename identity<Arg3>::type arg3,
3368 typename identity<Arg4>::type arg4)
3372 (std_cxx11::bind(fun_ptr,
3387 template <
typename RT,
typename C,
3388 typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
3392 typename identity<C>::type &c,
3393 typename identity<Arg1>::type arg1,
3394 typename identity<Arg2>::type arg2,
3395 typename identity<Arg3>::type arg3,
3396 typename identity<Arg4>::type arg4)
3400 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3407 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3414 template <
typename RT,
typename C,
3415 typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
3419 typename identity<const C>::type &c,
3420 typename identity<Arg1>::type arg1,
3421 typename identity<Arg2>::type arg2,
3422 typename identity<Arg3>::type arg3,
3423 typename identity<Arg4>::type arg4)
3427 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3443 template <
typename RT,
3444 typename Arg1,
typename Arg2,
typename Arg3,
3445 typename Arg4,
typename Arg5>
3449 typename identity<Arg1>::type arg1,
3450 typename identity<Arg2>::type arg2,
3451 typename identity<Arg3>::type arg3,
3452 typename identity<Arg4>::type arg4,
3453 typename identity<Arg5>::type arg5)
3457 (std_cxx11::bind(fun_ptr,
3473 template <
typename RT,
typename C,
3474 typename Arg1,
typename Arg2,
typename Arg3,
3475 typename Arg4,
typename Arg5>
3479 typename identity<C>::type &c,
3480 typename identity<Arg1>::type arg1,
3481 typename identity<Arg2>::type arg2,
3482 typename identity<Arg3>::type arg3,
3483 typename identity<Arg4>::type arg4,
3484 typename identity<Arg5>::type arg5)
3488 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3496 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3503 template <
typename RT,
typename C,
3504 typename Arg1,
typename Arg2,
typename Arg3,
3505 typename Arg4,
typename Arg5>
3508 new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5)
const,
3509 typename identity<const C>::type &c,
3510 typename identity<Arg1>::type arg1,
3511 typename identity<Arg2>::type arg2,
3512 typename identity<Arg3>::type arg3,
3513 typename identity<Arg4>::type arg4,
3514 typename identity<Arg5>::type arg5)
3518 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3535 template <
typename RT,
3536 typename Arg1,
typename Arg2,
typename Arg3,
3537 typename Arg4,
typename Arg5,
typename Arg6>
3540 new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6),
3541 typename identity<Arg1>::type arg1,
3542 typename identity<Arg2>::type arg2,
3543 typename identity<Arg3>::type arg3,
3544 typename identity<Arg4>::type arg4,
3545 typename identity<Arg5>::type arg5,
3546 typename identity<Arg6>::type arg6)
3550 (std_cxx11::bind(fun_ptr,
3567 template <
typename RT,
typename C,
3568 typename Arg1,
typename Arg2,
typename Arg3,
3569 typename Arg4,
typename Arg5,
typename Arg6>
3572 new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6),
3573 typename identity<C>::type &c,
3574 typename identity<Arg1>::type arg1,
3575 typename identity<Arg2>::type arg2,
3576 typename identity<Arg3>::type arg3,
3577 typename identity<Arg4>::type arg4,
3578 typename identity<Arg5>::type arg5,
3579 typename identity<Arg6>::type arg6)
3583 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3592 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3599 template <
typename RT,
typename C,
3600 typename Arg1,
typename Arg2,
typename Arg3,
3601 typename Arg4,
typename Arg5,
typename Arg6>
3604 new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6)
const,
3605 typename identity<const C>::type &c,
3606 typename identity<Arg1>::type arg1,
3607 typename identity<Arg2>::type arg2,
3608 typename identity<Arg3>::type arg3,
3609 typename identity<Arg4>::type arg4,
3610 typename identity<Arg5>::type arg5,
3611 typename identity<Arg6>::type arg6)
3615 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3633 template <
typename RT,
3634 typename Arg1,
typename Arg2,
typename Arg3,
3635 typename Arg4,
typename Arg5,
typename Arg6,
3639 new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7),
3640 typename identity<Arg1>::type arg1,
3641 typename identity<Arg2>::type arg2,
3642 typename identity<Arg3>::type arg3,
3643 typename identity<Arg4>::type arg4,
3644 typename identity<Arg5>::type arg5,
3645 typename identity<Arg6>::type arg6,
3646 typename identity<Arg7>::type arg7)
3650 (std_cxx11::bind(fun_ptr,
3668 template <
typename RT,
typename C,
3669 typename Arg1,
typename Arg2,
typename Arg3,
3670 typename Arg4,
typename Arg5,
typename Arg6,
3674 new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7),
3675 typename identity<C>::type &c,
3676 typename identity<Arg1>::type arg1,
3677 typename identity<Arg2>::type arg2,
3678 typename identity<Arg3>::type arg3,
3679 typename identity<Arg4>::type arg4,
3680 typename identity<Arg5>::type arg5,
3681 typename identity<Arg6>::type arg6,
3682 typename identity<Arg7>::type arg7)
3686 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3696 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3703 template <
typename RT,
typename C,
3704 typename Arg1,
typename Arg2,
typename Arg3,
3705 typename Arg4,
typename Arg5,
typename Arg6,
3709 new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)
const,
3710 typename identity<const C>::type &c,
3711 typename identity<Arg1>::type arg1,
3712 typename identity<Arg2>::type arg2,
3713 typename identity<Arg3>::type arg3,
3714 typename identity<Arg4>::type arg4,
3715 typename identity<Arg5>::type arg5,
3716 typename identity<Arg6>::type arg6,
3717 typename identity<Arg7>::type arg7)
3721 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3740 template <
typename RT,
3741 typename Arg1,
typename Arg2,
typename Arg3,
3742 typename Arg4,
typename Arg5,
typename Arg6,
3743 typename Arg7,
typename Arg8>
3748 typename identity<Arg1>::type arg1,
3749 typename identity<Arg2>::type arg2,
3750 typename identity<Arg3>::type arg3,
3751 typename identity<Arg4>::type arg4,
3752 typename identity<Arg5>::type arg5,
3753 typename identity<Arg6>::type arg6,
3754 typename identity<Arg7>::type arg7,
3755 typename identity<Arg8>::type arg8)
3759 (std_cxx11::bind(fun_ptr,
3778 template <
typename RT,
typename C,
3779 typename Arg1,
typename Arg2,
typename Arg3,
3780 typename Arg4,
typename Arg5,
typename Arg6,
3781 typename Arg7,
typename Arg8>
3786 typename identity<C>::type &c,
3787 typename identity<Arg1>::type arg1,
3788 typename identity<Arg2>::type arg2,
3789 typename identity<Arg3>::type arg3,
3790 typename identity<Arg4>::type arg4,
3791 typename identity<Arg5>::type arg5,
3792 typename identity<Arg6>::type arg6,
3793 typename identity<Arg7>::type arg7,
3794 typename identity<Arg8>::type arg8)
3798 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3809 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3816 template <
typename RT,
typename C,
3817 typename Arg1,
typename Arg2,
typename Arg3,
3818 typename Arg4,
typename Arg5,
typename Arg6,
3819 typename Arg7,
typename Arg8>
3823 Arg6,Arg7,Arg8)
const,
3824 typename identity<const C>::type &c,
3825 typename identity<Arg1>::type arg1,
3826 typename identity<Arg2>::type arg2,
3827 typename identity<Arg3>::type arg3,
3828 typename identity<Arg4>::type arg4,
3829 typename identity<Arg5>::type arg5,
3830 typename identity<Arg6>::type arg6,
3831 typename identity<Arg7>::type arg7,
3832 typename identity<Arg8>::type arg8)
3836 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3856 template <
typename RT,
3857 typename Arg1,
typename Arg2,
typename Arg3,
3858 typename Arg4,
typename Arg5,
typename Arg6,
3859 typename Arg7,
typename Arg8,
typename Arg9>
3863 Arg6,Arg7,Arg8,Arg9),
3864 typename identity<Arg1>::type arg1,
3865 typename identity<Arg2>::type arg2,
3866 typename identity<Arg3>::type arg3,
3867 typename identity<Arg4>::type arg4,
3868 typename identity<Arg5>::type arg5,
3869 typename identity<Arg6>::type arg6,
3870 typename identity<Arg7>::type arg7,
3871 typename identity<Arg8>::type arg8,
3872 typename identity<Arg9>::type arg9)
3876 (std_cxx11::bind(fun_ptr,
3896 template <
typename RT,
typename C,
3897 typename Arg1,
typename Arg2,
typename Arg3,
3898 typename Arg4,
typename Arg5,
typename Arg6,
3899 typename Arg7,
typename Arg8,
typename Arg9>
3903 Arg6,Arg7,Arg8,Arg9),
3904 typename identity<C>::type &c,
3905 typename identity<Arg1>::type arg1,
3906 typename identity<Arg2>::type arg2,
3907 typename identity<Arg3>::type arg3,
3908 typename identity<Arg4>::type arg4,
3909 typename identity<Arg5>::type arg5,
3910 typename identity<Arg6>::type arg6,
3911 typename identity<Arg7>::type arg7,
3912 typename identity<Arg8>::type arg8,
3913 typename identity<Arg9>::type arg9)
3917 (std_cxx11::bind(fun_ptr, std_cxx11::ref(c),
3929 #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG 3936 template <
typename RT,
typename C,
3937 typename Arg1,
typename Arg2,
typename Arg3,
3938 typename Arg4,
typename Arg5,
typename Arg6,
3939 typename Arg7,
typename Arg8,
typename Arg9>
3943 Arg6,Arg7,Arg8,Arg9)
const,
3944 typename identity<const C>::type &c,
3945 typename identity<Arg1>::type arg1,
3946 typename identity<Arg2>::type arg2,
3947 typename identity<Arg3>::type arg3,
3948 typename identity<Arg4>::type arg4,
3949 typename identity<Arg5>::type arg5,
3950 typename identity<Arg6>::type arg6,
3951 typename identity<Arg7>::type arg7,
3952 typename identity<Arg8>::type arg8,
3953 typename identity<Arg9>::type arg9)
3957 (std_cxx11::bind(fun_ptr, std_cxx11::cref(c),
3986 template <
typename RT =
void>
3995 tasks.push_back (t);
4007 for (
typename std::list<
Task<RT> >::const_iterator
4008 t=tasks.begin(); t!=tasks.end(); ++t)
4027 DEAL_II_NAMESPACE_CLOSE
std_cxx11::condition_variable condition_variable
Task(const std_cxx11::function< RT()> &function_object)
std::vector< std::pair< ForwardIterator, ForwardIterator > > split_range(const ForwardIterator &begin, const ForwardIterator &end, const unsigned int n_intervals)
unsigned int this_thread_id()
void start(const std_cxx11::function< RT()> &function)
Thread(const Thread< RT > &t)
TaskDescriptor< RT > & task_descriptor
std::list< Task< RT > > tasks
Thread(const std_cxx11::function< RT()> &function)
static void thread_entry_point(const std_cxx11::function< RT()> function, std_cxx11::shared_ptr< return_value< RT > > ret_val)
ScopedLock(DummyThreadMutex &)
#define AssertThrow(cond, exc)
std::vector< std::pair< unsigned int, unsigned int > > split_interval(const unsigned int begin, const unsigned int end, const unsigned int n_intervals)
#define DeclException1(Exception1, type1, outsequence)
Thread< RT > new_thread(const std_cxx11::function< RT()> &function)
#define Assert(cond, exc)
#define DeclExceptionMsg(Exception, defaulttext)
unsigned int n_existing_threads()
void wait(DummyThreadMutex &) const
std_cxx11::shared_ptr< internal::ThreadDescriptor< RT > > thread_descriptor
std_cxx11::shared_ptr< return_value< RT > > ret_val
PosixThreadBarrier Barrier
Task(const Task< RT > &t)
Mutex thread_is_active_mutex
pthread_barrier_t barrier
std_cxx11::shared_ptr< internal::TaskDescriptor< RT > > task_descriptor
Task< RT > new_task(const std_cxx11::function< RT()> &function)
std::list< Thread< RT > > threads