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


C++ SystemGlobals::GV方法代码示例

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


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

示例1: run

void DummySandbox::run() {
  TRACE(2, "DummySandbox::run\n");
  ThreadInfo *ti = ThreadInfo::s_threadInfo.getNoCheck();
  Debugger::RegisterThread();
  ti->m_reqInjectionData.setDummySandbox(true);
  while (!m_stopped) {
    try {
      CLISession hphpSession;

      DSandboxInfo sandbox = m_proxy->getSandbox();
      string msg;
      if (sandbox.valid()) {
        SystemGlobals *g = (SystemGlobals *)get_global_variables();
        SourceRootInfo sri(sandbox.m_user, sandbox.m_name);
        if (sandbox.m_path.empty()) {
          sandbox.m_path = sri.path();
        }
        if (!sri.sandboxOn()) {
          msg = "Invalid sandbox was specified. "
            "PHP files may not be loaded properly.\n";
        } else {
          sri.setServerVariables(g->GV(_SERVER));
        }
        Debugger::RegisterSandbox(sandbox);
        g_context->setSandboxId(sandbox.id());

        char cwd[PATH_MAX];
        getcwd(cwd, sizeof(cwd));
        std::string doc = getStartupDoc(sandbox);
        Logger::Info("Start loading startup doc '%s', pwd = '%s'",
                     doc.c_str(), cwd);
        bool error; string errorMsg;
        bool ret = hphp_invoke(g_context.getNoCheck(), doc, false, null_array,
                               uninit_null(), "", "", error, errorMsg, true, false,
                               true);
        if (!ret || error) {
          msg += "Unable to pre-load " + doc;
          if (!errorMsg.empty()) {
            msg += ": " + errorMsg;
          }
        }
        Logger::Info("Startup doc " + doc + " loaded");
      } else {
        g_context->setSandboxId(m_proxy->getDummyInfo().id());
      }

      ti->m_reqInjectionData.setDebugger(true);
      {
        DebuggerDummyEnv dde;
        Debugger::InterruptSessionStarted(nullptr, msg.c_str());
      }

      // Blocking until Ctrl-C is issued by end user and DebuggerProxy cannot
      // find a real sandbox thread to handle it.
      {
        Lock lock(this);
        while (!m_stopped && m_signum != CmdSignal::SignalBreak) {
          wait(1);
        }
        if (m_stopped) {
          // stopped by worker thread
          break;
        }
        m_signum = CmdSignal::SignalNone;
      }
    } catch (const DebuggerClientExitException &e) {
      // stopped by the dummy sandbox thread itself
      break;
    } catch (const DebuggerException &e) {
    }
  }
}
开发者ID:CSRedRat,项目名称:hiphop-php,代码行数:72,代码来源:dummy_sandbox.cpp

示例2: GetProxy

DebuggerProxyPtr Debugger::GetProxy() {
  SystemGlobals *g = (SystemGlobals*)get_global_variables();
  String id = g->GV(_SERVER)["HPHP_SANDBOX_ID"];
  return s_debugger.findProxy(id.data());
}
开发者ID:ckwalsh,项目名称:hiphop-php,代码行数:5,代码来源:debugger.cpp


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