|
libqi-api
2.4.3.28
|
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 () |
| 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) |
| void | post (const boost::function< void()> &callback) |
| post a callback to be executed as soon as possible More... | |
| 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=0) |
| Call given function once after given delay in microseconds. More... | |
| Future< void > | async (const boost::function< void()> &callback, uint64_t usDelay=0) |
| Future< void > | async (const boost::function< void()> &callback, qi::Duration delay) |
| call a callback asynchronously to be executed in delay More... | |
| Future< void > | async (const boost::function< void()> &callback, qi::SteadyClockTimePoint timepoint) |
| call a callback asynchronously to be executed on tp More... | |
| template<typename R > | |
| boost::enable_if_c <!boost::is_same< R, void > ::value, qi::Future< R > >::type | async (const boost::function< R()> &callback, qi::Duration delay) |
| template<typename R > | |
| boost::enable_if_c <!boost::is_same< R, void > ::value, qi::Future< R > >::type | async (const boost::function< R()> &callback, qi::SteadyClockTimePoint tp) |
Public Member Functions inherited from qi::ExecutionContext | |
| virtual | ~ExecutionContext () |
| template<typename R > | |
| boost::disable_if < boost::is_same< R, void > , qi::Future< R > >::type | async (const boost::function< R()> &callback, qi::Duration delay=qi::Duration(0)) |
| call a callback asynchronously to be executed in delay More... | |
| template<typename R > | |
| boost::disable_if < boost::is_same< R, void > , qi::Future< R > >::type | async (const boost::function< R()> &callback, qi::SteadyClockTimePoint tp) |
| call a callback asynchronously to be executed on tp More... | |
Public Attributes | |
| EventLoopPrivate * | _p |
| std::string | _name |
Class to handle eventloop. .
Definition at line 41 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.
|
inline |
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.
| Future<void> qi::EventLoop::async | ( | const boost::function< void()> & | callback, |
| uint64_t | usDelay = 0 |
||
| ) |
|
virtual |
call a callback asynchronously to be executed in delay
Implements qi::ExecutionContext.
|
virtual |
call a callback asynchronously to be executed on tp
Implements qi::ExecutionContext.
|
inline |
Definition at line 101 of file eventloop.hpp.
|
inline |
Definition at line 108 of file eventloop.hpp.
|
virtual |
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.
| void qi::EventLoop::post | ( | const boost::function< void()> & | callback, |
| uint64_t | usDelay | ||
| ) |
Similar to async() but without cancelation or notification.
| callback | Callback to be called. |
| usDelay | Delay before call the callback in microsecond. |
| void qi::EventLoop::post | ( | const boost::function< void()> & | callback, |
| qi::Duration | delay | ||
| ) |
| void qi::EventLoop::post | ( | const boost::function< void()> & | callback, |
| qi::SteadyClockTimePoint | timepoint | ||
| ) |
|
inlinevirtual |
post a callback to be executed as soon as possible
Implements qi::ExecutionContext.
Definition at line 123 of file eventloop.hpp.
| 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.
| std::string qi::EventLoop::_name |
Definition at line 139 of file eventloop.hpp.
| EventLoopPrivate* qi::EventLoop::_p |
Definition at line 138 of file eventloop.hpp.