16
16
17
17
modm::platform::SerialPort::SerialPort ():
18
18
shutdown(true ),
19
- port(io_service )
19
+ port(io_context )
20
20
{
21
21
}
22
22
@@ -28,7 +28,7 @@ modm::platform::SerialPort::~SerialPort()
28
28
void
29
29
modm::platform::SerialPort::write (char c)
30
30
{
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));
32
32
}
33
33
34
34
@@ -84,9 +84,9 @@ modm::platform::SerialPort::open(std::string deviceName, unsigned int baudRate)
84
84
this ->port .set_option (boost::asio::serial_port_base::character_size (8 ));
85
85
this ->port .set_option (boost::asio::serial_port_base::stop_bits (boost::asio::serial_port_base::stop_bits::one));
86
86
87
- this ->io_service . post ( boost::bind (&SerialPort::readStart, this ));
87
+ boost::asio::post ( this ->io_context , boost::bind (&SerialPort::readStart, this ));
88
88
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 ));
90
90
}
91
91
else {
92
92
std::cerr << " Port already open!" << std::endl;
@@ -108,14 +108,14 @@ modm::platform::SerialPort::close()
108
108
if (!this ->isOpen ())
109
109
return ;
110
110
111
- this ->io_service . post ( boost::bind (
111
+ boost::asio::post ( this ->io_context , boost::bind (
112
112
&modm::platform::SerialPort::doClose,
113
113
this ,
114
114
boost::system::error_code ()));
115
115
116
116
this ->thread ->join ();
117
117
delete this ->thread ;
118
- this ->io_service . reset ();
118
+ this ->io_context . restart ();
119
119
}
120
120
121
121
void
@@ -124,14 +124,14 @@ modm::platform::SerialPort::kill()
124
124
if (!this ->isOpen ())
125
125
return ;
126
126
127
- this ->io_service . post ( boost::bind (
127
+ boost::asio::post ( this ->io_context , boost::bind (
128
128
&modm::platform::SerialPort::doAbort,
129
129
this ,
130
130
boost::system::error_code ()));
131
131
this ->shutdown = true ;
132
132
this ->thread ->join ();
133
133
delete this ->thread ;
134
- this ->io_service . reset ();
134
+ this ->io_context . restart ();
135
135
}
136
136
137
137
void
0 commit comments