| 771 | } |
| 772 | |
| 773 | SC::Result SC::AsyncFileSystemOperation::close(AsyncEventLoop& eventLoop, FileDescriptor::Handle handle) |
| 774 | { |
| 775 | SC_TRY(checkState()); |
| 776 | operation = Operation::Close; |
| 777 | new (&closeData, PlacementNew()) CloseData({handle}); |
| 778 | if (not eventLoop.needsThreadPoolForFileOperations() and threadPoolMode != AsyncThreadPoolMode::ForceThreadPool) |
| 779 | { |
| 780 | return eventLoop.start(*this); |
| 781 | } |
| 782 | |
| 783 | loopWork.work = [&]() |
| 784 | { |
| 785 | FileDescriptor fd(closeData.handle); |
| 786 | return fd.close(); |
| 787 | }; |
| 788 | loopWork.callback.bind<AsyncFileSystemOperation, &AsyncFileSystemOperation::onOperationCompleted>(*this); |
| 789 | return eventLoop.start(loopWork); |
| 790 | } |
| 791 | |
| 792 | SC::Result SC::AsyncFileSystemOperation::read(AsyncEventLoop& eventLoop, FileDescriptor::Handle handle, |
| 793 | Span<char> buffer, uint64_t offset) |
| 794 | { |
| 795 | SC_TRY(checkState()); |
| 796 | operation = Operation::Read; |
| 797 | new (&readData, PlacementNew()) ReadData({handle, buffer, offset}); |
| 798 | if (not eventLoop.needsThreadPoolForFileOperations() and threadPoolMode != AsyncThreadPoolMode::ForceThreadPool) |
no test coverage detected