From 50932d93f1bac0a08e0a065fcc9d8b99153ff884 Mon Sep 17 00:00:00 2001 From: cqwrteur <100043421+trcrsired@users.noreply.github.com> Date: Sat, 10 Aug 2024 04:50:28 -0400 Subject: [PATCH 1/2] If the mutex type is movable, we do not add wrapper for it --- include/fast_io_hosted/threads/mutex/impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fast_io_hosted/threads/mutex/impl.h b/include/fast_io_hosted/threads/mutex/impl.h index 2cda3081c..a5b332623 100644 --- a/include/fast_io_hosted/threads/mutex/impl.h +++ b/include/fast_io_hosted/threads/mutex/impl.h @@ -37,7 +37,8 @@ using native_mutex = ; template -using basic_mutex_movable = ::fast_io::basic_general_mutex_movable; +using basic_mutex_movable = ::std::conditional_t<::std::movable, Mutex, + ::fast_io::basic_general_mutex_movable>; using native_mutex_movable = ::fast_io::basic_mutex_movable; template From 82116c8eaf6af2309c1423be94737ddfba0f1976 Mon Sep 17 00:00:00 2001 From: cqwrteur <100043421+trcrsired@users.noreply.github.com> Date: Sat, 10 Aug 2024 04:52:54 -0400 Subject: [PATCH 2/2] io_lockable fix for reopen --- include/fast_io_core_impl/io_lockable.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/fast_io_core_impl/io_lockable.h b/include/fast_io_core_impl/io_lockable.h index 890556c21..0d0ef5258 100644 --- a/include/fast_io_core_impl/io_lockable.h +++ b/include/fast_io_core_impl/io_lockable.h @@ -49,8 +49,7 @@ struct basic_general_io_lockable_nonmovable } else { - ::std::destroy_at(__builtin_addressof(handle)); - ::std::construct_at(__builtin_addressof(handle), ::std::forward(args)...); + this->handle = T(::std::forward(args)...); } } constexpr void close() noexcept(noexcept(handle.close()))