diff --git a/support/include/utils/file_thread_file.hpp b/support/include/utils/file_thread_file.hpp index 15234d80..88bb100e 100644 --- a/support/include/utils/file_thread_file.hpp +++ b/support/include/utils/file_thread_file.hpp @@ -93,7 +93,7 @@ private: fs_file_t file_; private: - mutable std::vector actions_; + mutable std::vector> actions_; mutable std::unique_ptr io_thread_; mutable std::unique_ptr mtx_{std::make_unique()}; mutable std::unique_ptr notify_{ diff --git a/support/src/utils/file_thread_file.cpp b/support/src/utils/file_thread_file.cpp index 20576091..b4b5d09c 100644 --- a/support/src/utils/file_thread_file.cpp +++ b/support/src/utils/file_thread_file.cpp @@ -20,6 +20,7 @@ SOFTWARE. */ #include "utils/file_thread_file.hpp" +#include namespace repertory::utils::file { // auto thread_file::attach_file(native_handle handle, @@ -104,14 +105,14 @@ auto thread_file::do_io(action_t action) const -> bool { io_thread_ = std::make_unique([this]() { thread_func(); }); } - io_item item{action}; - actions_.emplace_back(&item); + auto item = std::make_shared(action); + actions_.emplace_back(item); notify_->notify_all(); lock.unlock(); - item.wait(); + item->wait(); - return item.success; + return item->success; } void thread_file::flush() const {