本文整理汇总了C++中AsioSession::getCurrentContext方法的典型用法代码示例。如果您正苦于以下问题:C++ AsioSession::getCurrentContext方法的具体用法?C++ AsioSession::getCurrentContext怎么用?C++ AsioSession::getCurrentContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsioSession
的用法示例。
在下文中一共展示了AsioSession::getCurrentContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: join
// throws on context depth level overflows and cross-context cycles
void c_WaitableWaitHandle::join() {
AsioSession* session = AsioSession::Get();
assert(!isFinished());
assert(!session->isInContext() || session->getCurrentContext()->isRunning());
if (UNLIKELY(session->hasOnJoinCallback())) {
session->onJoin(this);
}
// enter new asio context and set up guard that will exit once we are done
session->enterContext();
assert(session->isInContext());
assert(!session->getCurrentContext()->isRunning());
try {
// import this wait handle to the newly created context
// throws if cross-context cycle found
enterContext(session->getCurrentContextIdx());
// run queues until we are finished
session->getCurrentContext()->runUntil(this);
} catch (const Object& exception) {
// recover from PHP exceptions; HPHP internal exceptions are deliberately
// ignored as there is no easy way to recover from them
session->exitContext();
throw;
}
session->exitContext();
assert(isFinished());
}
示例2: join
// throws on context depth level overflows and cross-context cycles
void c_WaitableWaitHandle::join() {
JIT::EagerVMRegAnchor _;
AsioSession* session = AsioSession::Get();
assert(!isFinished());
assert(!session->isInContext() || session->getCurrentContext()->isRunning());
if (UNLIKELY(session->hasOnJoinCallback())) {
session->onJoin(this);
}
// enter new asio context and set up guard that will exit once we are done
session->enterContext();
auto exit_guard = folly::makeGuard([&] { session->exitContext(); });
assert(session->isInContext());
assert(!session->getCurrentContext()->isRunning());
// import this wait handle to the newly created context
// throws if cross-context cycle found
enterContext(session->getCurrentContextIdx());
// run queues until we are finished
session->getCurrentContext()->runUntil(this);
assert(isFinished());
}
示例3: join
// throws on context depth level overflows and cross-context cycles
void c_WaitableWaitHandle::join() {
EagerVMRegAnchor _;
auto const savedFP = vmfp();
assertx(!isFinished());
AsioSession* session = AsioSession::Get();
if (UNLIKELY(session->hasOnJoin())) {
session->onJoin(this);
}
// enter new asio context and set up guard that will exit once we are done
session->enterContext(savedFP);
auto exit_guard = folly::makeGuard([&] { session->exitContext(); });
// import this wait handle to the newly created context
// throws if cross-context cycle found
asio::enter_context(this, session->getCurrentContextIdx());
// run queues until we are finished
session->getCurrentContext()->runUntil(this);
assertx(isFinished());
}