Tags: patch
I tested the patch posted in the upstream bug tracker, and can confirm that it
works.
A version that applies against 1.3.0+dfsg1-5.1 is attached.
The patch also works with boost 1.83, no changes for current unstable are
needed.
Please include it in the next upload.
--- a/xs/src/libslic3r/GCodeSender.cpp
+++ b/xs/src/libslic3r/GCodeSender.cpp
@@ -98,12 +98,12 @@
fs.open("serial.txt", std::fstream::out | std::fstream::trunc);
#endif
- // this gives some work to the io_service before it is started
+ // this gives some work to the io_context before it is started
// (post() runs the supplied function in its thread)
- this->io.post(boost::bind(&GCodeSender::do_read, this));
+ boost::asio::post(this->io, [this]() { this->do_read(); });
// start reading in the background thread
- boost::thread t(boost::bind(&asio::io_service::run, &this->io));
+ boost::thread t(boost::bind(&asio::io_context::run, &this->io));
this->background_thread.swap(t);
// always send a M105 to check for connection because firmware might be silent on connect
@@ -158,9 +158,9 @@
if (!this->open) return;
this->open = false;
this->connected = false;
- this->io.post(boost::bind(&GCodeSender::do_close, this));
+ boost::asio::post(this->io, [this]() { this->do_read(); });
this->background_thread.join();
- this->io.reset();
+ this->io.restart();
/*
if (this->error_status()) {
throw(boost::system::system_error(boost::system::error_code(),
@@ -443,7 +443,7 @@
void
GCodeSender::send()
{
- this->io.post(boost::bind(&GCodeSender::do_send, this));
+ boost::asio::post(this->io, [this]() { this->do_send(); });
}
void
--- a/xs/src/libslic3r/GCodeSender.hpp
+++ b/xs/src/libslic3r/GCodeSender.hpp
@@ -37,7 +37,7 @@
void reset();
private:
- asio::io_service io;
+ asio::io_context io;
asio::serial_port serial;
boost::thread background_thread;
boost::asio::streambuf read_buffer, write_buffer;