Required Instance Methodswift-nio 2.84.0NIOCore

withUnsafeFileDescriptor(_:)

Will be called with the file descriptor if still open, if not it will throw an IOError.

FileDescriptor.swift:26
func withUnsafeFileDescriptor<T>(_ body: (CInt) throws -> T) throws -> T

Parameters

body

The closure to execute if the FileDescriptor is still open.

Throws

If either the FileDescriptor was closed before or the closure throws by itself.

The ownership of the file descriptor must not escape the body as it’s completely managed by the implementation of the FileDescriptor protocol.