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


C++ ExecutionContext::fiberInit方法代码示例

本文整理汇总了C++中ExecutionContext::fiberInit方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutionContext::fiberInit方法的具体用法?C++ ExecutionContext::fiberInit怎么用?C++ ExecutionContext::fiberInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExecutionContext的用法示例。


在下文中一共展示了ExecutionContext::fiberInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

  // FIBER THREAD
  void run() {
    // make local copy of m_function and m_params
    if (m_async) {
      try {
        s_fiber_data->m_fiberThread = true;

        ExecutionContext *context = g_context.getNoCheck();
        if (context && m_context) {
          context->fiberInit(m_context, m_refMap);
          const VirtualHost *vhost = m_context->getVirtualHost();
          if (vhost) {
            VirtualHost::SetCurrent((VirtualHost *)vhost);
          }
          m_context = context; // switching role
        }

        AutoloadHandler *handler = AutoloadHandler::s_instance.get();
        if (handler && m_autoload_handler) {
          handler->fiberInit(m_autoload_handler, m_refMap);
          m_autoload_handler = handler; // switching role
        }

        (m_evalState = Eval::RequestEvalState::Get())->
          fiberInit(m_unmarshaled_evalState, m_refMap);
        m_function = m_function.fiberMarshal(m_refMap);
        m_params = m_params.fiberMarshal(m_refMap);
        ThreadInfo::s_threadInfo->m_globals =
          m_global_variables = get_global_variables();
        fiber_marshal_global_state(m_global_variables,
                                   m_unmarshaled_global_variables, m_refMap);
      } catch (const Exception &e) {
        m_fatal = String(e.getMessage());
      } catch (...) {
        m_fatal = String("unknown exception was thrown");
      }

      Lock lock(this);
      m_ready = true;
      notify();
    }

    if (m_fatal.isNull()) {
      try {
        m_return = f_call_user_func_array(m_function, m_params);
      } catch (const ExitException &e) {
        m_exit = true;
      } catch (const Exception &e) {
        m_fatal = String(e.getMessage());
      } catch (Object e) {
        m_exception = e;
      } catch (...) {
        m_fatal = String("unknown exception was thrown");
      }
    }

    {
      Lock lock(this);
      m_done = true;
      notify();
    }
    {
      Lock lock(m_thread);
      m_thread->notify();
    }
  }
开发者ID:activeingredient,项目名称:hiphop-php,代码行数:66,代码来源:fiber_async_func.cpp


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