Open System Services Programmer's Guide
Table 58 Comparison of spt_*, spt_*x, and spt_*z Functions
Behavior for Regular FilesBehavior for Non-Regular FilesFunction Set
Always process-blocking (all threads in the
process must wait for I/O to complete).
File descriptor is nonblocking:spt_*()
◦ Function is thread-aware (other threads
can continue to run)
◦ Function blocks the calling thread.
File descriptor is not nonblocking: this
function is process-blocking (all threads in
the process must wait for I/O to complete).
Always process-blocking (all threads in the
process must wait for I/O to complete)
Always thead-aware. Can be nonblocking
for the calling thread.
File descriptor is nonblocking:
spt_*x()
◦ Function is nonblocking thread- aware
(does not block any threads, including
the calling thread): it returns an error
instead of blocking the thread.
File descriptor is not nonblocking:
◦ Function is thread-aware (other threads
can continue to run)
◦ Function blocks the calling thread.
Always thead-aware:
1
Always thead-aware. Can be nonblocking
for the calling thread.
File descriptor is nonblocking:
spt_*z()
◦ Function is thread-aware (other threads
can continue to run)
◦ Function is nonblocking thread- aware
(does not block any threads, including
the calling thread): it returns an error
instead of blocking the thread.
◦ Function blocks the calling thread.
I/O operations by multiple threads on the
same open file are serialized.
File descriptor is not nonblocking:
◦ Function is thread-aware (other threads
can continue to run)
◦ Function blocks the calling thread.
1
The functions spt_fstat64z(), spt_fstatz(), spt_lseek64z(), and spt_lseek64z() are not thread
aware but support the spt_*z() thread-aware functions for regular files by serializing file operations on an open
file.
Equivalent System, Thread-Aware, and Nonblocking Thread-Aware Functions
Table 59 lists standard functions that have equivalent thread-aware functions. For example:
• read() is a process-blocking function for both regular files and for non-regular files.
• spt_read() is a thread-aware function with this behavior:
For non-regular files, the file descriptor must be nonblocking for this function to be
thread-aware. This function blocks the calling thread, but allows other threads to run.
◦
◦ For regular files, this function blocks the entire process.
• spt_readx() is a thread-aware function with this behavior:
For non-regular files, this function does not require the file descriptor to be nonblocking
for this function to be thread-aware. If the file description is nonblocking, this function
◦
does not block the calling thread, and returns one of these errors to the application:
Thread-Aware and Nonblocking OSS Functions 343