/*
|
* =====================================================================================
|
*
|
* Filename: io_service.h
|
*
|
* Description:
|
*
|
* Version: 1.0
|
* Created: 2021年05月27日 13时25分37秒
|
* Revision: none
|
* Compiler: gcc
|
*
|
* Author: Li Chao (), lichao@aiotlink.com
|
* Organization:
|
*
|
* =====================================================================================
|
*/
|
#ifndef IO_SERVICE_ODKKJG3D
|
#define IO_SERVICE_ODKKJG3D
|
|
#include <boost/asio.hpp>
|
#include <thread>
|
|
class IoService
|
{
|
public:
|
IoService();
|
~IoService();
|
|
typedef boost::asio::io_context io_service_t;
|
io_service_t &io() { return io_; }
|
|
private:
|
io_service_t io_;
|
typedef boost::asio::executor_work_guard<io_service_t::executor_type> guard_t;
|
guard_t guard_;
|
std::thread worker_;
|
};
|
|
#endif // end of include guard: IO_SERVICE_ODKKJG3D
|