Skip to content

Commit

Permalink
Bump 4.3.1
Browse files Browse the repository at this point in the history
Refining the resource cleanup process for io_service during the handle_stop phase, particularly when a worker thread is terminated externally
  • Loading branch information
halx99 committed Sep 7, 2024
1 parent 7e51fbb commit b9c0868
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion yasio.pc
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion yasio/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion yasio/io_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(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<int>(buffer_.size() - offset_), revent, error);
}
bool io_transport::do_write(highp_time_t& wait_duration)
{
bool ret = false;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b9c0868

Please sign in to comment.