SafeFileHandle.CreateAnonymousPipe Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an anonymous pipe.
public static void CreateAnonymousPipe(out Microsoft.Win32.SafeHandles.SafeFileHandle readHandle, out Microsoft.Win32.SafeHandles.SafeFileHandle writeHandle, bool asyncRead = false, bool asyncWrite = false);
static member CreateAnonymousPipe : SafeFileHandle * SafeFileHandle * bool * bool -> unit
Public Shared Sub CreateAnonymousPipe (ByRef readHandle As SafeFileHandle, ByRef writeHandle As SafeFileHandle, Optional asyncRead As Boolean = false, Optional asyncWrite As Boolean = false)
Parameters
- readHandle
- SafeFileHandle
When this method returns, contains the read end of the pipe.
- writeHandle
- SafeFileHandle
When this method returns, contains the write end of the pipe.
- asyncRead
- Boolean
true to enable asynchronous I/O for the read end of the pipe; otherwise, false.
- asyncWrite
- Boolean
true to enable asynchronous I/O for the write end of the pipe; otherwise, false.
Exceptions
An I/O error occurred while creating the pipe.
A Windows error occurred while creating the pipe.
Remarks
To avoid accidental handle leaks to child processes, the created handles aren't inheritable.
On Windows, asynchronous handles are created with the FILE_FLAG_OVERLAPPED flag. On Unix, asynchronous handles are created with the O_NONBLOCK flag.
The returned handles own their underlying resources. Dispose both handles when they're no longer needed.