pool_adaptors.hpp
Go to the documentation of this file.
00001 
00018 #ifndef THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED
00019 #define THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED
00020 
00021 #include <boost/smart_ptr.hpp>
00022 
00023 
00024 namespace boost { namespace threadpool
00025 {
00026 
00027 
00028 // TODO convenience scheduling function
00035     template<typename Pool, typename Runnable>
00036     bool schedule(Pool& pool, shared_ptr<Runnable> const & obj)
00037     {   
00038       return pool->schedule(bind(&Runnable::run, obj));
00039     }   
00040     
00044     template<typename Pool>
00045     typename enable_if < 
00046       is_void< typename result_of< typename Pool::task_type() >::type >,
00047       bool
00048     >::type
00049     schedule(Pool& pool, typename Pool::task_type const & task)
00050     {   
00051       return pool.schedule(task);
00052     }   
00053 
00054 
00055     template<typename Pool>
00056     typename enable_if < 
00057       is_void< typename result_of< typename Pool::task_type() >::type >,
00058       bool
00059     >::type
00060     schedule(shared_ptr<Pool> const pool, typename Pool::task_type const & task)
00061     {   
00062       return pool->schedule(task);
00063     }   
00064 
00065 
00066 } } // namespace boost::threadpool
00067 
00068 #endif // THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED
00069 
00070 


or_libs
Author(s): raphael
autogenerated on Mon Oct 6 2014 02:53:18