2023-05-07 01:33:14 +00:00

31 lines
513 B
C++

#include "precompile.h"
#include "iomgr.h"
#ifdef USE_ASIO
void IoMgr::Init()
{
for (int i = 0; i < IC_Max; ++i) {
io_contexts_.push_back(std::vector<std::shared_ptr<asio::io_context>>());
}
}
void IoMgr::UnInit()
{
}
std::shared_ptr<asio::io_context> IoMgr::GetIoContext(int type)
{
if (type >= 0 && type < io_contexts_.size()) {
auto& s = io_contexts_.at(type);
if (s.empty()) {
return s.at(rand() % s.size());
}
}
return nullptr;
}
#endif