예제 #1
0
void AsioSession::updateEventHookState() {
    if (hasOnResumableCreate() ||
            hasOnResumableAwait() ||
            hasOnResumableSuccess()) {
        EventHook::EnableAsync();
    } else {
        EventHook::DisableAsync();
    }
}
예제 #2
0
파일: event-hook.cpp 프로젝트: Rongx/hhvm
// Child is the AFWH we're going to block on, nullptr iff this is a suspending
// generator.
void EventHook::onFunctionSuspendR(ActRec* suspending, ObjectData* child) {
  auto const flags = check_request_surprise();
  onFunctionExit(suspending, nullptr, false, nullptr, flags);

  if ((flags & AsyncEventHookFlag) &&
      suspending->func()->isAsyncFunction()) {
    assert(child != nullptr);  // This isn't a generator
    assert(child->instanceof(c_WaitableWaitHandle::classof()));
    assert(suspending->resumed());
    auto const afwh = frame_afwh(suspending);
    auto const session = AsioSession::Get();
    if (session->hasOnResumableAwait()) {
      session->onResumableAwait(
        afwh,
        static_cast<c_WaitableWaitHandle*>(child)
      );
    }
  }
}