Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/thread/executors/detail/scheduled_executor_base.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2014 Ian Forbed
0002 // Copyright (C) 2014-2015 Vicente J. Botet Escriba
0003 //
0004 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_THREAD_EXECUTORS_DETAIL_SCHEDULED_EXECUTOR_BASE_HPP
0009 #define BOOST_THREAD_EXECUTORS_DETAIL_SCHEDULED_EXECUTOR_BASE_HPP
0010 
0011 #include <boost/thread/concurrent_queues/sync_timed_queue.hpp>
0012 #include <boost/thread/executors/detail/priority_executor_base.hpp>
0013 #include <boost/thread/executors/work.hpp>
0014 #include <boost/thread/thread.hpp>
0015 
0016 #include <boost/atomic.hpp>
0017 #include <boost/function.hpp>
0018 
0019 #include <boost/config/abi_prefix.hpp>
0020 
0021 namespace boost
0022 {
0023 namespace executors
0024 {
0025 namespace detail
0026 {
0027   template <class Clock=chrono::steady_clock>
0028   class scheduled_executor_base : public priority_executor_base<concurrent::sync_timed_queue<executors::work_pq, Clock  > >
0029   {
0030   public:
0031     typedef executors::work_pq work;
0032     typedef Clock clock;
0033     typedef typename clock::duration duration;
0034     typedef typename clock::time_point time_point;
0035   protected:
0036 
0037     scheduled_executor_base() {}
0038   public:
0039 
0040     ~scheduled_executor_base()
0041     {
0042       if(! this->closed())
0043       {
0044         this->close();
0045       }
0046     }
0047 
0048     void submit_at(work w, const time_point& tp)
0049     {
0050       this->_workq.push(boost::move(w), tp);
0051     }
0052 
0053     void submit_after(work w, const duration& dura)
0054     {
0055       this->_workq.push(boost::move(w), dura+clock::now());
0056     }
0057 
0058   }; //end class
0059 
0060 } //end detail namespace
0061 } //end executors namespace
0062 } //end boost namespace
0063 
0064 #include <boost/config/abi_suffix.hpp>
0065 
0066 #endif