本文整理汇总了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;
}
示例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;
}