本文整理汇总了C++中qi::Future::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ Future::connect方法的具体用法?C++ Future::connect怎么用?C++ Future::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qi::Future
的用法示例。
在下文中一共展示了Future::connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addFuture
/**
* \brief Adds the future to the barrier.
* \return Whether the future could be added.
*
* \verbatim
* This adds the future to the barrier. It means barrier's future won't return
* until this one returns. It will also be added to the resulting vector.
*
* When :cpp:func:`qi::FutureBarrier::future()` has been called, this function
* will throw.
* \endverbatim
*/
void addFuture(qi::Future<T> fut) {
// Can't add future from closed qi::FutureBarrier.
if (*_p->_closed)
throw std::runtime_error("Adding future to closed barrier");
++(_p->_count);
fut.connect(boost::bind<void>(&detail::FutureBarrierPrivate<T>::onFutureFinish, _p));
_p->_futures.push_back(fut);
}
示例2: _reschedule
void PeriodicTaskPrivate::_reschedule(qi::Duration delay)
{
qiLogDebug() << "rescheduling in " << qi::to_string(delay);
if (_scheduleCallback)
_task = _scheduleCallback(boost::bind(&PeriodicTaskPrivate::_wrap, shared_from_this()), delay);
else
_task = getEventLoop()->asyncDelay(boost::bind(&PeriodicTaskPrivate::_wrap, shared_from_this()), delay);
_state = TaskState::Scheduled;
_task.connect(boost::bind(
&PeriodicTaskPrivate::_onTaskFinished, shared_from_this(), _1));
}