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


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

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


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

示例1: ti_create

Object c_GenArrayWaitHandle::ti_create(CArrRef dependencies) {
  Array deps = dependencies->copy();
  for (ssize_t iter_pos = deps->iter_begin();
       iter_pos != ArrayData::invalid_index;
       iter_pos = deps->iter_advance(iter_pos)) {

    TypedValue* current = deps->nvGetValueRef(iter_pos);
    if (UNLIKELY(current->m_type == KindOfRef)) {
      tvUnbox(current);
    }

    if (!c_WaitHandle::fromTypedValue(current) &&
        !IS_NULL_TYPE(current->m_type)) {
      Object e(SystemLib::AllocInvalidArgumentExceptionObject(
        "Expected dependencies to be an array of WaitHandle instances"));
      throw e;
    }
  }

  Object exception;
  for (ssize_t iter_pos = deps->iter_begin();
       iter_pos != ArrayData::invalid_index;
       iter_pos = deps->iter_advance(iter_pos)) {

    TypedValue* current = deps->nvGetValueRef(iter_pos);
    if (IS_NULL_TYPE(current->m_type)) {
      // {uninit,null} yields null
      tvWriteNull(current);
      continue;
    }

    assert(current->m_type == KindOfObject);
    assert(dynamic_cast<c_WaitHandle*>(current->m_data.pobj));
    auto child = static_cast<c_WaitHandle*>(current->m_data.pobj);

    if (child->isSucceeded()) {
      tvSetIgnoreRef(child->getResult(), current);
    } else if (child->isFailed()) {
      putException(exception, child->getException());
    } else {
      assert(dynamic_cast<c_WaitableWaitHandle*>(child));
      auto child_wh = static_cast<c_WaitableWaitHandle*>(child);

      p_GenArrayWaitHandle my_wh = NEWOBJ(c_GenArrayWaitHandle)();
      my_wh->initialize(exception, deps, iter_pos, child_wh);

      AsioSession* session = AsioSession::Get();
      if (UNLIKELY(session->hasOnGenArrayCreateCallback())) {
        session->onGenArrayCreate(my_wh.get(), dependencies);
      }

      return my_wh;
    }
  }

  if (exception.isNull()) {
    TypedValue tv;
    tv.m_type = KindOfArray;
    tv.m_data.parr = deps.get();
    return c_StaticResultWaitHandle::Create(&tv);
  } else {
    return c_StaticExceptionWaitHandle::Create(exception.get());
  }
}
开发者ID:MarkTseng,项目名称:hiphop-php,代码行数:64,代码来源:gen_array_wait_handle.cpp


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