diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9502f7..b7cbbce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +yasio-4.3.1 + + 1. Refining the resource cleanup process for io_service during the handle_stop phase, particularly when a worker thread is terminated externally + + yasio-4.3.0 1. Use dynamic buffer for recv diff --git a/yasio.pc b/yasio.pc index 8a3900f0..002b7be7 100644 --- a/yasio.pc +++ b/yasio.pc @@ -5,6 +5,6 @@ includedir=${exec_prefix}/include Name: yasio Description: A multi-platform support c++11 library with focus on asio (asynchronous socket I/O) for any client application. -Version: 4.3.0 +Version: 4.3.1 Libs: -L${libdir} Cflags: -I${includedir}/yasio diff --git a/yasio/config.hpp b/yasio/config.hpp index f7ac4d29..c41511f5 100644 --- a/yasio/config.hpp +++ b/yasio/config.hpp @@ -205,7 +205,7 @@ SOFTWARE. /* ** The yasio version macros */ -#define YASIO_VERSION_NUM 0x040300 +#define YASIO_VERSION_NUM 0x040301 /* ** The macros used by io_service. diff --git a/yasio/io_service.cpp b/yasio/io_service.cpp index 89e70765..18069957 100644 --- a/yasio/io_service.cpp +++ b/yasio/io_service.cpp @@ -376,7 +376,10 @@ int io_transport::write(io_send_buffer&& buffer, completion_cb_t&& handler) get_service().wakeup(); return n; } -int io_transport::do_read(int revent, int& error, highp_time_t&) { return this->call_read(buffer_.data() + offset_, static_cast(buffer_.size() - offset_), revent, error); } +int io_transport::do_read(int revent, int& error, highp_time_t&) +{ + return this->call_read(buffer_.data() + offset_, static_cast(buffer_.size() - offset_), revent, error); +} bool io_transport::do_write(highp_time_t& wait_duration) { bool ret = false; @@ -828,6 +831,12 @@ void io_service::handle_stop() return; } this->worker_.join(); + if (this->state_ != state::AT_EXITING) + { + // after join if state not AT_EXITING, means worker thread was terminate outside + // i.g .net managed exception occurred when invoke c# delegate + this->state_ = state::AT_EXITING; + } } if (this->state_ != state::AT_EXITING)