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

📄 client_acceptor.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
字号:
// client_acceptor.cpp,v 1.5 2002/02/21 22:38:46 schmidt Exp

#include "client_acceptor.h"

/* Construct ourselves with the chosen concurrency strategy.  Notice
   that we also set our Thread_Pool reference to our private instance.  */
Client_Acceptor::Client_Acceptor (int concurrency)
  : concurrency_ (concurrency),
    the_thread_pool_ (private_thread_pool_)
{
}

/* Construct ourselves with a reference to somebody else' Thread_Pool.
   Obvioulsy our concurrency strategy is "thread_pool_" at this point.  */
Client_Acceptor::Client_Acceptor (Thread_Pool &thread_pool)
  : concurrency_ (thread_pool_),
    the_thread_pool_ (thread_pool)
{
}

/* When we're destructed, we may need to cleanup after ourselves.  If
   we're running with a thread pool that we own, it is up to us to
   close it down.  */
Client_Acceptor::~Client_Acceptor (void)
{
  if (this->concurrency() == thread_pool_ && thread_pool_is_private ())
    thread_pool ()->close ();
}

/* Similar to the destructor (and close() below) it is necessary for
   us to open the thread pool in some circumstances.

   Notice how we delegate most of the open() work to the open() method
   of our baseclass.  */
int
Client_Acceptor::open (const ACE_INET_Addr &addr,
                       ACE_Reactor *reactor,
                       int pool_size)
{
  if (this->concurrency() == thread_pool_ && thread_pool_is_private ())
    thread_pool ()->start (pool_size);

  return inherited::open (addr, reactor);
}

/* Here again we find that we have to manage the thread pool.  Like
   open() we also delegate the other work to our baseclass.  */
int
Client_Acceptor::close (void)
{
  if (this->concurrency() == thread_pool_ && thread_pool_is_private ())
    thread_pool ()->stop ();

  return inherited::close ();
}

⌨️ 快捷键说明

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