Open System Services Programmer's Guide
Example 95 (page 412) uses the default callback mechanism by registering the file number via
put_regFile(2). In some cases, you may wish to provide your own callback using
put_regFileIOHandler(2), which registers the file number as one you will manage through
the callback you define.
Example 95 Thread-Aware Toolkit Program Flow
...
FILE_OPEN(…, &filenum, …);
put_regFile(filenum);
...
// Do work on filenum.
...
put_unregFile(filenum);
FILE_CLOSE(filenum);
...
Example 96 Simplified Program Flow For a Thread-Aware Function
...
READX(filenum, ...);
pute = put_awaitio(filenum, tag, -1, count_read, &error, NULL);
if (pute != put_SUCCESS) (void) CANCELREQ(filenum, tag);
return error;
...
Example 97 illustrates using a nonblocking thread-aware read() function. If you were to disable
thread-aware behavior by using the PUT_THREAD_AWARE_REGULAR_IO_DISABLE environment
variable, you risk blocking the whole process if the file descriptor points to a regular file.
412 Using the POSIX User Thread (PUT) Model Library