Open System Services Programmer's Guide

Example 98 Example READX() Function Used In Thread-Aware Manner
{
put_error_t spte;
long error;
_cc_status cc;
long tag;
tag = put_generateTag();
cc = READX(filenum, buffer, read_count, , tag);
/* If READX() failed. */
if (_status_lt(cc))
{
short short_error;
(void) FILE_GETINFO_(filenum, &short_error);
return short_error;
}
/* Loop forever. */
while (1)
{
spte = put_awaitio(filenum, tag, timelimit, count_read,
&error, NULL);
/* If spte is put_INTERRUPTED then try again. */
if (spte != put_INTERRUPTED) break;
}
/* If put_awaitio() was unsuccessful.*/
if (spte != put_SUCCESS) (void) CANCELREQ(filenum, tag);
return error;
}
Caveats to Using the Thread-Aware Toolkit
Proper operation of the thread-aware toolkit depends on the following conditions:
No calls to AWAITIO[X] () with a file number of -1 are made.
No calls to AWAITIO[X] () with a file number registered with pthreads are made.
No calls to FILE_COMPLETE_SET_ () are made.
No calls to FILE_COMPLETE_ () are made using the permanent set.
Thread-Aware $RECEIVE I/O Functions
$RECEIVE thread-aware functions (Table 71) integrate the following basic $RECEIVE I/O functions
with the POSIX thread engine and support.
Read $RECEIVE (similar to READUPDATEX) so that it is thread-blocking, but not process-blocking.
Read $RECEIVE from one or multiple threads and returning all pertinent information
(FILE_GETRECEIVEINFO) in a thread-safe form.
Inherit transactions on $RECEIVE and properly associating or disassociating the transaction
with the calling thread.
Block a reading thread if the number of messages read has exceeded receive depth.
For details on each function, see the appropriate reference page in the Open System Services
System Calls Reference Manual.
414 Using the POSIX User Thread (PUT) Model Library