diff --git a/asio b/asio index d038fb3c2fb56fb91ff1d17b0715cff7887aa09e..08a7029cb10c911b6fb66fb015217a431206e52c 160000 --- a/asio +++ b/asio @@ -1 +1 @@ -Subproject commit d038fb3c2fb56fb91ff1d17b0715cff7887aa09e +Subproject commit 08a7029cb10c911b6fb66fb015217a431206e52c diff --git a/examples/udp_test/udp_test.cpp b/examples/udp_test/udp_test.cpp index 614ee693fe2e874312cc84fd11e4d0688ce9f2ff..f9f208ccdd1e67600df9cb26d969d7382c7509b9 100644 --- a/examples/udp_test/udp_test.cpp +++ b/examples/udp_test/udp_test.cpp @@ -40,7 +40,7 @@ template std::thread create_sync_recv_thread(Socket& socket) }); } -//because st_asio_wrapper is header only, it cannot provide the implementation of below global function, but kcp needs it, +//because ascs is header only, it cannot provide the implementation of below global function, but kcp needs it, //you're supposed to provide it and call reliable_socket_base::output directly in it, like: int output(const char* buf, int len, ikcpcb * kcp, void* user) {return ((single_reliable_socket_service*) user)->output(buf, len);} diff --git a/include/ascs/service_pump.h b/include/ascs/service_pump.h index 7027004e0b6accd21575eb8ab1f2cbf775cddd08..69a5981c930b4eae3ea52eae04b5decfb22da6b7 100644 --- a/include/ascs/service_pump.h +++ b/include/ascs/service_pump.h @@ -164,15 +164,15 @@ public: throw "no available io_context!"; } - void return_io_context(const asio::execution_context& io_context) + void return_io_context(const asio::execution_context& io_context, unsigned refs = 1) { if (!single_io_context) - ascs::do_something_to_one(context_can, context_can_mutex, [&](context& item) {return &io_context != &item.io_context ? false : (--item.refs, true);}); + ascs::do_something_to_one(context_can, context_can_mutex, [&](context& item) {return &io_context != &item.io_context ? false : (item.refs -= refs, true);}); } - void assign_io_context(const asio::execution_context& io_context) + void assign_io_context(const asio::execution_context& io_context, unsigned refs = 1) { if (!single_io_context) - ascs::do_something_to_one(context_can, context_can_mutex, [&](context& item) {return &io_context != &item.io_context ? false : (++item.refs, true);}); + ascs::do_something_to_one(context_can, context_can_mutex, [&](context& item) {return &io_context != &item.io_context ? false : (item.refs += refs, true);}); } object_type find(int id)