Open System Services Programmer's Guide
Table 73 Thread-Aware Callback Functions and Types
DescriptionFunction
Callback type required by put_regOSSFileIOHandler().put_OSSFileIOHandler_p
Register the file descriptor as one that the user will manage through a user
supplied callback.
put_regOSSFileIOHandler
Unregister file descriptor as one that the user will manage.put_unregOSSFileIOHandler
Set interest in file descriptor.put_setOSSFileIOHandler
Register a user supplied timer callback.put_regTimerHandler
Callback type required by put_regTimerHandler().put_TimerHandler_p
Using OSS and Timer Callbacks
Example 103 shows an OSS file descriptor callback program flow. Typically, the callback would
conditionally signal a thread that the file descriptor is read-ready.
Example 103 OSS File Descriptor Callback
...
put_regOSSFileIOHandler(fd, callback);
put_setOSSFileIOHandler(fd, 1, 0, 0); // Only interested in read ready.
...
// Do work on file descriptor via user supplied callback.
...
put_unregOSSFileIOHandler(fd);
...
Example 104 shows an OSS timer callback program flow. As soon as possible, the pthreads
scheduler initially invokes the timer callback, with successive invocations of the callback driven by
the callback’s return value. For more information, see the put_TimerHandler_p(2) reference
page.
Example 104 Timer Callback Program Flow
...
put_regTimerHandler(callback);
...
Caveat to Using Callbacks
An OSS field descriptor callback takes precedent over all other operations that are waiting on the
file descriptor. For example, if a thread is blocked on put_fd_read_ready() and there is a
callback registered for that particular file descriptor, the thread will never be awakened by the file
descriptor being read-ready, even if the callback didn’t set interest in read-ready.
Timer callbacks must not block and may be invoked sooner or later than requested.
Converting Applications that use the SPT Library
The Standard POSIX Thread (SPT) library continues to be supported. You can run existing SPT
applications without changes. However, for H06.21 and later H-series RVUs and J06.10 and later
J-series RVUs, you must specify the _SPT_MODEL_ macro when you compile applications that use
the SPT library. For more information about the SPT library, see Chapter 11 (page 285).
This section describes instructions and considerations for converting an application from using the
SPT library to using the PUT Model library.
Converting Applications that use the SPT Library 423