|
libqi-api
release-2.5.3-2016-11-18
|
Class to handle eventloop. . More...
#include <eventloop.hpp>
Public Member Functions | |
| EventLoop (const std::string &name="eventloop") | |
| Create a new eventLoop. More... | |
| ~EventLoop () | |
| Default destructor. More... | |
| bool | isInThisContext () override |
| Check if current thread is the event loop thread. More... | |
| void | start (int nthreads=0) |
| Start the eventloop in threaded mode. More... | |
| void | join () |
| Wait for run thread to terminate. More... | |
| void | stop () |
| Ask main loop to terminate. More... | |
| void | setEmergencyCallback (boost::function< void()> cb) |
| Set callback to be called in case of a deadlock detection. More... | |
| void | setMaxThreads (unsigned int max) |
| Set the maximum number of threads in the pool. More... | |
| void * | nativeHandle () |
| Internal function. More... | |
| void | post (const boost::function< void()> &callback, uint64_t usDelay) |
| Similar to async() but without cancelation or notification. More... | |
| void | post (const boost::function< void()> &callback, qi::Duration delay) |
| void | post (const boost::function< void()> &callback, qi::SteadyClockTimePoint timepoint) |
| Future< void > | monitorEventLoop (EventLoop *helper, uint64_t maxUsDelay) |
| Monitor event loop to detect deadlocks. More... | |
| template<typename R > | |
| Future< R > | async (const boost::function< R()> &callback, uint64_t usDelay) |
| Call given function once after given delay in microseconds. More... | |
| Future< void > | async (const boost::function< void()> &callback, uint64_t usDelay) |
| Future< void > | async (const boost::function< void()> &callback, qi::Duration delay) override |
| Future< void > | async (const boost::function< void()> &callback, qi::SteadyClockTimePoint timepoint) override |
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 to handle eventloop. .
Definition at line 42 of file eventloop.hpp.
| qi::EventLoop::EventLoop | ( | const std::string & | name = "eventloop" | ) |
Create a new eventLoop.
| name | Name of the event loop created. |
You must then call either start(), run() or startThreadPool() to start event processing.
| qi::EventLoop::~EventLoop | ( | ) |
Default destructor.
| Future< R > qi::EventLoop::async | ( | const boost::function< R()> & | callback, |
| uint64_t | usDelay | ||
| ) |
Call given function once after given delay in microseconds.
| callback | Callback to be called. |
| usDelay | Delay before call the callback in microsecond. |
Definition at line 21 of file eventloop.hxx.
|
inline |
Definition at line 98 of file eventloop.hpp.
|
inlineoverridevirtual |
call a callback asynchronously to be executed in delay
Implements qi::ExecutionContext.
Definition at line 103 of file eventloop.hpp.
|
inlineoverridevirtual |
call a callback asynchronously to be executed on tp
Implements qi::ExecutionContext.
Definition at line 108 of file eventloop.hpp.
|
overridevirtual |
Check if current thread is the event loop thread.
Implements qi::ExecutionContext.
| void qi::EventLoop::join | ( | ) |
Wait for run thread to terminate.
Monitor event loop to detect deadlocks.
| helper | an other event loop used for monitoring. |
| maxUsDelay | maximum expected delay between an async() and its execution. |
| void* qi::EventLoop::nativeHandle | ( | ) |
Internal function.
|
inline |
Similar to async() but without cancelation or notification.
| callback | Callback to be called. |
| usDelay | Delay before call the callback in microsecond. |
Definition at line 123 of file eventloop.hpp.
|
inline |
Definition at line 128 of file eventloop.hpp.
| void qi::EventLoop::post | ( | const boost::function< void()> & | callback, |
| qi::SteadyClockTimePoint | timepoint | ||
| ) |
| void qi::EventLoop::setEmergencyCallback | ( | boost::function< void()> | cb | ) |
Set callback to be called in case of a deadlock detection.
| cb | Callback to be called. |
| void qi::EventLoop::setMaxThreads | ( | unsigned int | max | ) |
Set the maximum number of threads in the pool.
| max | Maximum number of threads. |
| void qi::EventLoop::start | ( | int | nthreads = 0 | ) |
Start the eventloop in threaded mode.
| nthreads | Numbers of threads. |
| void qi::EventLoop::stop | ( | ) |
Ask main loop to terminate.