⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer_handler.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
字号:
// -*- C++ -*-

// =========================================================================
/**
 *  @file  Timer_Handler.cpp
 *
 *  Timer_Handler.cpp,v 1.5 2002/10/19 06:54:50 mayur Exp
 *
 *  @desc  Fires servant upcall after a specified period of delay
 *
 *  @author Mayur Deshpande <mayur@ics.uci.edu>
 *
 */
// =========================================================================

#include "Timer_Handler.h"

Timer_Handler::Timer_Handler (Test::AMH_RoundtripResponseHandler_ptr rh,
                              Test::Timestamp send_time)
  : rh_ (Test::AMH_RoundtripResponseHandler::_duplicate (rh))
  , send_time_ (send_time)
{
}

int
Timer_Handler::handle_timeout (const ACE_Time_Value &,
                               const void *)
{
  ACE_TRY_NEW_ENV
    {
      this->rh_->test_method (this->send_time_);
      ACE_TRY_CHECK;
    }
  ACE_CATCHANY
    {
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception in Timer_Handler::handle_timeout \n");
      return -1;
    }
  ACE_ENDTRY;

  // Returning -1 calls handle_close which will clean up and
  // deregister this handle from the reactor. DO not return anything
  // else.  I changes the return value inadvertently and it caused a
  // memory leak.  should have RTMFed this before.  Took me a ****
  // long time to figure out this memory leak, though in retrospect I
  // should looked here first.
  return -1;
}


int
Timer_Handler::handle_close (ACE_HANDLE,
                             ACE_Reactor_Mask)
{
  // deregister from the reactor and destruct

  delete this;
  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -