acl/lib_acl_cpp/samples/gui_rpc/rpc/rpc_manager.cpp

30 lines
757 B
C++
Raw Normal View History

#include "stdafx.h"
2014-11-19 00:25:21 +08:00
#include "rpc_manager.h"
rpc_manager::rpc_manager(int max_threads /* = 10 */)
{
// <20><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD> main ֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>־
2014-11-19 00:25:21 +08:00
logger_open("gui_rpc.log", "gui_rpc");
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WIN32 <20><>Ϣģʽ<C4A3><CABD>acl::ENGINE_WINMSG
2014-11-19 00:25:21 +08:00
handle_ = new acl::aio_handle(acl::ENGINE_WINMSG);
// <20><><EFBFBD><EFBFBD> rpc <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
service_ = new acl::rpc_service(max_threads);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
if (service_->open(handle_) == false)
logger_fatal("open service error: %s", acl::last_serror());
}
rpc_manager::~rpc_manager()
{
delete service_;
handle_->check();
delete handle_;
logger("rpc service destroy ok!");
}
void rpc_manager::fork(acl::rpc_request* req)
{
service_->rpc_fork(req);
}