Open System Services Programmer's Guide

For details on each function, see the appropriate reference page in the Open System Services
System Calls Reference Manual.
Table 61 Thread-Aware Toolkit Functions and Types
DescriptionFunction
Unregister the file number as one you will manage. Any threads waiting
on file number I/O will awaken with SPT_ERROR and system error 16.
spt_unregFile()
Callback type required by spt_regFileIOHandler(). A callback
is executed in the context of the last running thread; that is, it executes
on the stack of the last running thread.
spt_FileIOHandler_p()
Register the file number as one you will manage through a user-supplied
callback. Invoke this callback immediately after each I/O on filenum
completes.
spt_regFileIOHandler()
Wake up a thread awaiting the tagged I/O on file number. The
awakened thread returns from spt_awaitio() with SPT_SUCCESS.
spt_wakeup()
Default callback used by spt_regFile(). It calls spt_wakeup()
and passes on the supplied parameters.
spt_defaultCallback()
Register the file number as one you will manage through the default
callback.
spt_regFile()
Await a tagged IO on file number to complete, timeout, or be interrupted.
I/O is never canceled by this function, and completes only if
spt_awaitio()
SPT_SUCCESS is returned. Multiple threads should not await the same
tagged I/O on any given file number.
Interrupt all threads awaiting I/O on file number. I/O is not cancelled
by this function. Interrupted threads will return from spt_awaitio()
with a return value of SPT_ERROR.
spt_interrupt()
Interrupt the thread awaiting the tagged IO on file number. I/O is not
cancelled by this function. Interrupted threads will return from
spt_awaitio() with a return value of SPT_ERROR.
spt_interruptTag()
Increment and return a static long appropriate for use as a tag. This
long will eventually wrap and therefore return tags that may still be in
spt_generateTag()
use. For example, if a process calls spt_generateTag() 100 times
every second, the wrap will occur on the 248th day.
Wait on a file descriptor to be read ready or have an exception pending.spt_fd_read_ready()
Wait on a file descriptor to be write ready or have an exception
pending.
spt_fd_write_ready()
Using Thread-Aware Toolkit Functions
The following examples show using thread-aware toolkit functions:
Thread-aware toolkit program flow — Example 75 (page 370).
Simplified program flow for a thread-aware function — Example 76 (page 370)
Thread-aware read() function — Example 77 (page 370)
Nonblocking thread-aware read() function — Example 78 (page 371)
Function using spt_READX() Example 79 (page 372)
Example 75 (page 370) uses the default callback mechanism by registering the file number via
spt_regFile(2). In some cases, you may wish to provide your own callback using
spt_regFileIOHandler(2), which registers the file number as one you will manage through
the callback you define.
Reentrant OSS Functions 369