Applications use the OS/2 file system functions to read from and write to unnamed pipes.
The handles returned by DosCreatePipe are used as file handles to DosRead and DosWrite.
To write (or add data) to an unnamed pipe, call DosWrite, specifying the write handle of the pipe in DosWrite's file handle parameter. DosWrite requests to a pipe are processed in the order in which they are made. Multiple calls to DosWrite can be made before data is read (or removed) from the pipe. When the pipe becomes full, write requests are blocked until space is freed by read requests.
When the pipe is too full to hold the entire contents of the write request, the portion that will fit is written to the pipe before the writer is blocked.
To read from a pipe, call DosRead, specifying the read handle of the pipe in DosRead's file handle parameter. Subsequent calls to DosRead can empty the pipe if no further calls to DosWrite are made in the meantime.
Different threads writing to and reading from a pipe are not synchronized. It is possible for the pipe reader to obtain partial contents of a write request if the pipe becomes full during the write request.
If the process reading the pipe ends, the next DosWrite request for that pipe returns ERROR_BROKEN_PIPE.
Calling DosClose terminates access to an unnamed pipe. However, the pipe is not deleted from memory until all handles to the pipe have been closed, including any handles that were defined with DosDupHandle.