boost::corosio::stream_file::release

Release ownership of the native handle.

Synopsis

[[nodiscard]]
capy::results<native_handle_type>
release() noexcept;

Description

On success the file object becomes not‐open, and the caller is responsible for closing the returned handle.

release() cancels pending operations first. It reports errc::device_or_resource_busy if one is still in flight on Windows. Where file I/O runs on a thread pool, it reports the same while a worker thread is already performing one. Call release() again once the cancelled operations have completed. On Windows it reports errc::operation_not_supported if the handle cannot be detached from the execution context's completion port. Detaching requires Windows 8.1 or later.

A closed file reports errc::bad_file_descriptor. On failure the object keeps the handle and the returned handle is the invalid sentinel ( ‐1 or INVALID_HANDLE_VALUE ), never zero.

Return Value

The error code and the native file descriptor or handle.

The return value should not be discarded.

Created with MrDocs