Skip to main content

drop_nonblock

Function drop_nonblock 

Source
pub fn drop_nonblock(file: File) -> Result<File>
Expand description

Drop the O_NONBLOCK flag from an open file

This function takes ownership of the File to ensure that no other references to this specific file handle exist within the current scope while the flags are being modified. This mitigates race conditions where other threads might be attempting to read/write to the file or modify its flags concurrently via the same handle.

§Platform Behavior

  • Unix: Uses fcntl to clear O_NONBLOCK.
  • Windows: No-op (Windows file handles do not use O_NONBLOCK in the same way).

§Errors

Returns an error if the underlying syscall fails.