|
libqi-api
release-2.5.3-2016-11-18
|
#include <strand.hpp>
Public Member Functions | |
| Strand () | |
| Construct a strand that will schedule work on the default event loop. More... | |
| Strand (qi::ExecutionContext &executionContext) | |
| Construct a strand that will schedule work on executionContext. More... | |
| ~Strand () | |
| Call detroy() More... | |
| void | join () |
| qi::Future< void > | async (const boost::function< void()> &cb, qi::SteadyClockTimePoint tp) override |
| qi::Future< void > | async (const boost::function< void()> &cb, qi::Duration delay) override |
| bool | isInThisContext () override |
| template<typename F > | |
| auto | schedulerFor (F &&func, boost::function< void()> onFail={}) -> detail::WrapInStrand< typename std::decay< F >::type > |
Public Member Functions inherited from qi::ExecutionContext | |
| virtual | ~ExecutionContext () |
| template<typename R > | |
| boost::disable_if < std::is_same< R, void > , qi::Future< R > >::type | async (const boost::function< R()> &callback, qi::Duration delay) |
| template<typename R > | |
| boost::disable_if < std::is_same< R, void > , qi::Future< R > >::type | async (const boost::function< R()> &callback, qi::SteadyClockTimePoint tp) |
| template<typename R > | |
| qi::Future< R > | async (const detail::Function< R()> &callback) |
| template<typename F > | |
| void | post (F &&callback) |
| post a callback to be executed as soon as possible More... | |
| template<typename F > | |
| auto | asyncAt (F &&callback, qi::SteadyClockTimePoint tp) -> qi::Future< typename std::decay< decltype(callback())>::type > |
| call a callback asynchronously to be executed on tp More... | |
| template<typename F > | |
| auto | asyncDelay (F &&callback, qi::Duration delay) -> qi::Future< typename std::decay< decltype(callback())>::type > |
| call a callback asynchronously to be executed in delay More... | |
| template<typename F > | |
| auto | async (F &&callback) -> decltype(asyncDelay(std::forward< F >(callback), qi::Duration(0))) |
Additional Inherited Members |
Class that schedules tasks sequentially
A strand allows one to schedule work on an eventloop with the guaranty that two callback will never be called concurrently.
Methods are thread-safe except for destructor which must never be called concurrently.
Definition at line 101 of file strand.hpp.
| qi::Strand::Strand | ( | ) |
Construct a strand that will schedule work on the default event loop.
| qi::Strand::Strand | ( | qi::ExecutionContext & | executionContext | ) |
Construct a strand that will schedule work on executionContext.
| qi::Strand::~Strand | ( | ) |
Call detroy()
|
overridevirtual |
call a callback asynchronously to be executed on tp
Implements qi::ExecutionContext.
|
overridevirtual |
call a callback asynchronously to be executed in delay
Implements qi::ExecutionContext.
|
overridevirtual |
Implements qi::ExecutionContext.
| void qi::Strand::join | ( | ) |
Joins the strand
This will wait for currently running tasks to finish and will drop all tasks scheduled from the moment of the call on. A strand can't be reused after it has been join()ed.
It is safe to call this method concurrently with other methods. All the returned futures will be set to error.
|
inline |
Definition at line 153 of file strand.hpp.