1 // Copyright (C) 2014 Ian Forbed
2 // Copyright (C) 2014-2015 Vicente J. Botet Escriba
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_THREAD_EXECUTORS_DETAIL_SCHEDULED_EXECUTOR_BASE_HPP
9 #define BOOST_THREAD_EXECUTORS_DETAIL_SCHEDULED_EXECUTOR_BASE_HPP
11 #include <boost/thread/concurrent_queues/sync_timed_queue.hpp>
12 #include <boost/thread/executors/detail/priority_executor_base.hpp>
13 #include <boost/thread/executors/work.hpp>
14 #include <boost/thread/thread.hpp>
16 #include <boost/atomic.hpp>
17 #include <boost/function.hpp>
19 #include <boost/config/abi_prefix.hpp>
27 template <class Clock=chrono::steady_clock>
28 class scheduled_executor_base : public priority_executor_base<concurrent::sync_timed_queue<executors::work_pq, Clock > >
31 typedef executors::work_pq work;
33 typedef typename clock::duration duration;
34 typedef typename clock::time_point time_point;
37 scheduled_executor_base() {}
40 ~scheduled_executor_base()
48 void submit_at(work w, const time_point& tp)
50 this->_workq.push(boost::move(w), tp);
53 void submit_after(work w, const duration& dura)
55 this->_workq.push(boost::move(w), dura+clock::now());
60 } //end detail namespace
61 } //end executors namespace
62 } //end boost namespace
64 #include <boost/config/abi_suffix.hpp>