From f528b810e1ecacef6fd191e2e15499df1e24864a Mon Sep 17 00:00:00 2001 From: qicosmos Date: Thu, 18 May 2023 18:06:08 +0800 Subject: [PATCH] uninit libaio context --- include/asio/detail/impl/lib_aio_descriptor_service.ipp | 1 + include/asio/detail/lib_aio_descriptor_service.hpp | 1 + include/asio/detail/lib_aio_io_operation.hpp | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/include/asio/detail/impl/lib_aio_descriptor_service.ipp b/include/asio/detail/impl/lib_aio_descriptor_service.ipp index c1c0208..c48df17 100644 --- a/include/asio/detail/impl/lib_aio_descriptor_service.ipp +++ b/include/asio/detail/impl/lib_aio_descriptor_service.ipp @@ -73,6 +73,7 @@ void lib_aio_descriptor_service::destroy( asio::error_code ignored_ec; descriptor_ops::close(impl.descriptor_, impl.state_, ignored_ec); + destroy_aio_context(); } } diff --git a/include/asio/detail/lib_aio_descriptor_service.hpp b/include/asio/detail/lib_aio_descriptor_service.hpp index 6dc0641..6738758 100644 --- a/include/asio/detail/lib_aio_descriptor_service.hpp +++ b/include/asio/detail/lib_aio_descriptor_service.hpp @@ -34,6 +34,7 @@ #include "asio/detail/memory.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/posix/descriptor_base.hpp" +#include "asio/detail/reactive_wait_op.hpp" #include "asio/detail/reactor.hpp" #include "asio/file_base.hpp" diff --git a/include/asio/detail/lib_aio_io_operation.hpp b/include/asio/detail/lib_aio_io_operation.hpp index 4b9a27b..98fe15f 100644 --- a/include/asio/detail/lib_aio_io_operation.hpp +++ b/include/asio/detail/lib_aio_io_operation.hpp @@ -88,6 +88,11 @@ class lib_aio_io_operation } } + ASIO_DECL void destroy_aio_context() { + ::close(event_fd_); + ::io_destroy(aio_ctx_); + } + //submit async write some. template ASIO_DECL bool aio_io_submit_write(int descriptor,