1616
1717modm::platform::SerialPort::SerialPort ():
1818 shutdown(true ),
19- port(io_service )
19+ port(io_context )
2020{
2121}
2222
@@ -28,7 +28,7 @@ modm::platform::SerialPort::~SerialPort()
2828void
2929modm::platform::SerialPort::write (char c)
3030{
31- this ->io_service . post ( boost::bind (&modm::platform::SerialPort::doWrite, this , c));
31+ boost::asio::post ( this ->io_context , boost::bind (&modm::platform::SerialPort::doWrite, this , c));
3232}
3333
3434
@@ -84,9 +84,9 @@ modm::platform::SerialPort::open(std::string deviceName, unsigned int baudRate)
8484 this ->port .set_option (boost::asio::serial_port_base::character_size (8 ));
8585 this ->port .set_option (boost::asio::serial_port_base::stop_bits (boost::asio::serial_port_base::stop_bits::one));
8686
87- this ->io_service . post ( boost::bind (&SerialPort::readStart, this ));
87+ boost::asio::post ( this ->io_context , boost::bind (&SerialPort::readStart, this ));
8888
89- this ->thread = new boost::thread (boost::bind (&boost::asio::io_service ::run, &this ->io_service ));
89+ this ->thread = new boost::thread (boost::bind (&boost::asio::io_context ::run, &this ->io_context ));
9090 }
9191 else {
9292 std::cerr << " Port already open!" << std::endl;
@@ -108,14 +108,14 @@ modm::platform::SerialPort::close()
108108 if (!this ->isOpen ())
109109 return ;
110110
111- this ->io_service . post ( boost::bind (
111+ boost::asio::post ( this ->io_context , boost::bind (
112112 &modm::platform::SerialPort::doClose,
113113 this ,
114114 boost::system::error_code ()));
115115
116116 this ->thread ->join ();
117117 delete this ->thread ;
118- this ->io_service . reset ();
118+ this ->io_context . restart ();
119119}
120120
121121void
@@ -124,14 +124,14 @@ modm::platform::SerialPort::kill()
124124 if (!this ->isOpen ())
125125 return ;
126126
127- this ->io_service . post ( boost::bind (
127+ boost::asio::post ( this ->io_context , boost::bind (
128128 &modm::platform::SerialPort::doAbort,
129129 this ,
130130 boost::system::error_code ()));
131131 this ->shutdown = true ;
132132 this ->thread ->join ();
133133 delete this ->thread ;
134- this ->io_service . reset ();
134+ this ->io_context . restart ();
135135}
136136
137137void
0 commit comments