|
libqi-api
2.0.6.8
|
#include <eventloop.hpp>
Public Member Functions | |
| EventLoop () | |
| ~EventLoop () | |
| bool | isInEventLoopThread () |
| Return true if current thread is the event loop thread. | |
| void | start (int nthreads=0) |
| Start in threaded mode. | |
| void | startThreadPool (int minWorkers=-1, int maxWorkers=-1, int minIdleWorkers=-1, int maxIdleWorkers=-1) |
| Start in thread-pool mode: each asyncCall() will be run in parallel. | |
| void | join () |
| Wait for run thread to terminate. | |
| void | stop () |
| Ask main loop to terminate. | |
| void | run () |
| Run main loop in current thread. | |
| void | setEmergencyCallback (boost::function< void()> cb) |
| Set callback to be called in case of a deadlock detection. | |
| void | setMaxThreads (unsigned int max) |
| Set the maximum number of threads in the pool. | |
| void * | nativeHandle () |
| void | post (const boost::function< void()> &callback, uint64_t usDelay=0) |
| Similar to async() but without cancelation or notification. | |
| Future< void > | monitorEventLoop (EventLoop *helper, uint64_t maxUsDelay) |
| template<typename R > | |
| Future< R > | async (boost::function< R()> callback, uint64_t usDelay=0) |
| Future< void > | async (boost::function< void()> callback, uint64_t usDelay=0) |
Public Attributes | |
| EventLoopPrivate * | _p |
Definition at line 35 of file eventloop.hpp.
Create a new eventLoop. You must then call either start(), run() or startThreadPool() to start event processing.
| Future< R > qi::EventLoop::async | ( | boost::function< R()> | callback, |
| uint64_t | usDelay = 0 |
||
| ) |
Call given function once after given delay in microseconds.
Definition at line 51 of file eventloop.hxx.
| Future<void> qi::EventLoop::async | ( | boost::function< void()> | callback, |
| uint64_t | usDelay = 0 |
||
| ) |
| bool qi::EventLoop::isInEventLoopThread | ( | ) |
Return true if current thread is the event loop thread.
| void qi::EventLoop::join | ( | ) |
Wait for run thread to terminate.
| Future<void> qi::EventLoop::monitorEventLoop | ( | EventLoop * | helper, |
| uint64_t | maxUsDelay | ||
| ) |
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 | ( | ) |
| void qi::EventLoop::post | ( | const boost::function< void()> & | callback, |
| uint64_t | usDelay = 0 |
||
| ) |
Similar to async() but without cancelation or notification.
| void qi::EventLoop::run | ( | ) |
Run main loop in current thread.
| void qi::EventLoop::setEmergencyCallback | ( | boost::function< void()> | cb | ) |
Set callback to be called in case of a deadlock detection.
| void qi::EventLoop::setMaxThreads | ( | unsigned int | max | ) |
Set the maximum number of threads in the pool.
| void qi::EventLoop::start | ( | int | nthreads = 0 | ) |
Start in threaded mode.
| void qi::EventLoop::startThreadPool | ( | int | minWorkers = -1, |
| int | maxWorkers = -1, |
||
| int | minIdleWorkers = -1, |
||
| int | maxIdleWorkers = -1 |
||
| ) |
Start in thread-pool mode: each asyncCall() will be run in parallel.
| void qi::EventLoop::stop | ( | ) |
Ask main loop to terminate.
| EventLoopPrivate* qi::EventLoop::_p |
Definition at line 87 of file eventloop.hpp.