This commit is contained in:
@ -93,7 +93,7 @@ private:
|
||||
fs_file_t file_;
|
||||
|
||||
private:
|
||||
mutable std::vector<io_item *> actions_;
|
||||
mutable std::vector<std::shared_ptr<io_item>> actions_;
|
||||
mutable std::unique_ptr<std::thread> io_thread_;
|
||||
mutable std::unique_ptr<std::mutex> mtx_{std::make_unique<std::mutex>()};
|
||||
mutable std::unique_ptr<std::condition_variable> notify_{
|
||||
|
@ -20,6 +20,7 @@
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "utils/file_thread_file.hpp"
|
||||
#include <memory>
|
||||
|
||||
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<std::thread>([this]() { thread_func(); });
|
||||
}
|
||||
|
||||
io_item item{action};
|
||||
actions_.emplace_back(&item);
|
||||
auto item = std::make_shared<io_item>(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 {
|
||||
|
Reference in New Issue
Block a user