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


C++ ACE_Reactor::uses_event_associations方法代码示例

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


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

示例1: error

template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler
  (SVC_HANDLER *svc_handler)
{
  ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler");

  // Try to find out if the implementation of the reactor that we are
  // using requires us to reset the event association for the newly
  // created handle. This is because the newly created handle will
  // inherit the properties of the listen handle, including its event
  // associations.

  ACE_Reactor *reactor = this->reactor ();
  bool reset_new_handle;

  if (reactor)
    {
      reset_new_handle = reactor->uses_event_associations ();
    }
  else
    {
      // Acceptor is closed, so reject this call
      errno = EINVAL;
      return -1;
    }

  if (this->acceptor ().accept (svc_handler->peer (), // stream
                                0, // remote address
                                0, // timeout
                                true, // restart
                                reset_new_handle  // reset new handler
                                ) == -1)
    {
      // Ensure that errno is preserved in case the svc_handler
      // close() method resets it
      ACE_Errno_Guard error(errno);

      // Close down handler to avoid memory leaks.
      svc_handler->close (CLOSE_DURING_NEW_CONNECTION);

      return -1;
    }
  else
    return 0;
}
开发者ID:Kintoun,项目名称:POSA,代码行数:45,代码来源:Acceptor.cpp

示例2:

template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input (ACE_HANDLE)
{
  ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input");
  int result = 0;

  // Cancel any timer that might be pending.
  this->cancel ();

  // Try to find out if the implementation of the reactor that we are
  // using requires us to reset the event association for the newly
  // created handle.  This is because the newly created handle will
  // inherit the properties of the listen handle, including its event
  // associations.
  ACE_Reactor *reactor = this->reactor ();
  bool reset_new_handle = false;

  // There is a use-case whereby this object will be gone upon return
  // from shared_accept - if the Svc_Handler deletes this Oneshot_Acceptor
  // during the shared_accept/activation steps. So, do whatever we need
  // to do with this object before calling shared_accept.
  if (reactor)
    {
      reset_new_handle = reactor->uses_event_associations ();
      reactor->remove_handler
        (this,
        ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
    }

  if (this->shared_accept (this->svc_handler_, // stream
                           0, // remote address
                           0, // timeout
                           this->restart_, // restart
                           reset_new_handle // reset new handle
                           ) == -1)
    result = -1;

  return result;
}
开发者ID:Kintoun,项目名称:POSA,代码行数:39,代码来源:Acceptor.cpp


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