pool_adaptors.hpp
Go to the documentation of this file.
1 
18 #ifndef THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED
19 #define THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED
20 
21 #include <boost/smart_ptr.hpp>
22 
23 
24 namespace boost { namespace threadpool
25 {
26 
27 
28 // TODO convenience scheduling function
35  template<typename Pool, typename Runnable>
36  bool schedule(Pool& pool, shared_ptr<Runnable> const & obj)
37  {
38  return pool->schedule(bind(&Runnable::run, obj));
39  }
40 
44  template<typename Pool>
45  typename enable_if <
46  is_void< typename result_of< typename Pool::task_type() >::type >,
47  bool
48  >::type
49  schedule(Pool& pool, typename Pool::task_type const & task)
50  {
51  return pool.schedule(task);
52  }
53 
54 
55  template<typename Pool>
56  typename enable_if <
57  is_void< typename result_of< typename Pool::task_type() >::type >,
58  bool
59  >::type
60  schedule(shared_ptr<Pool> const pool, typename Pool::task_type const & task)
61  {
62  return pool->schedule(task);
63  }
64 
65 
66 } } // namespace boost::threadpool
67 
68 #endif // THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED
69 
70 
The namespace threadpool contains a thread pool and related utility classes.
disable_if< is_void< typename result_of< Function() >::type >, future< typename result_of< Function() >::type >>::type schedule(Pool &pool, const Function &task)
Definition: future.hpp:111


asr_descriptor_surface_based_recognition
Author(s): Allgeyer Tobias, Hutmacher Robin, Meißner Pascal
autogenerated on Mon Dec 16 2019 03:31:15