当前位置: 首页>>代码示例>>C++>>正文


C++ AsioSession::getCurrentContext方法代码示例

本文整理汇总了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());
}
开发者ID:CyaLiven,项目名称:hiphop-php,代码行数:34,代码来源:waitable_wait_handle.cpp

示例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());
}
开发者ID:NIT-Warangal,项目名称:Judge,代码行数:28,代码来源:waitable_wait_handle.cpp

示例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());
}
开发者ID:facebook,项目名称:hhvm,代码行数:24,代码来源:ext_waitable-wait-handle.cpp


注:本文中的AsioSession::getCurrentContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。