OSF DCE Application Development Guide--Introduction and Style Guide
Threads
• During the timeslice interruption.
• Within the DCE threads I/O wrappers for system calls that block. These are as
follows:
— read( )
— readv()
— select()
— write( )
— writev()
— accept()
— connect()
— recv( )
— recvmsg( )
— recvfrom()
— send()
— sendmsg( )
— sendto( )
• When pthread_setasynccancel() is called, and either of the following apply:
— It has set the cancelability state to asynchronous (general cancelability and
asynchronous cancelability are both enabled), it hasn’t yet returned, and a cancel
is pending.
— It was called to disable asynchronous cancelability state, but hasn’t yet done so,
and a cancellation request has been asynchronously delivered.
One important blocking routine that is not a cancellation point is
pthread_mutex_lock(), as this would create a domino effect so that every routine
calling it would also become a cancellation point. Thus, mutexes should be used only to
protect resources held for a short period of time so that noncancelability will not be a
problem. Resources needing to be held exclusively should be protected by condition
variables rather than mutexes, as this will not inhibit cancelability.
If a thread has not set disabled cancelability state, a cancellation request has been made
to that thread, and the thread executes pthread_testcancel(), the cancellation request
must be acted upon. Similarly, if a thread has not set disabled cancelability state, a
cancellation request has been made to that thread, and the thread is blocked at a
cancellation point waiting for an event to occcur, then that thread must act upon the
cancellation request. However, if a thread is suspended at a cancellation point and the
event for which it is waiting has completed before a cancellation request is received and
acted upon, the thread may resume normal execution and the cancellation request
remains pending.
124246 Tandem Computers Incorporated 2− 11