Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pthread_testintr(3T) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

threads(5)

sigwait(2)



pthread_setintr(3T)            DG/UX R4.11MU05           pthread_setintr(3T)


NAME
       pthreadsetintr, pthreadsetintrtype, pthreadtestintr - set
       interruptibility state

SYNOPSIS
       #include <pthread.h>

       int pthreadsetintr(int state);

       int pthreadsetintrtype(int type);

       void pthreadtestintr(void);

   where:
       state  Interruptibility state, an integer representing
              PTHREADINTRENABLE (default) or PTHREADINTRDISABLE
       type   Interruptibility type, an integer representing
              PTHREADINTRCONTROLLED (default) or PTHREADINTRASYNCHRONOUS

DESCRIPTION
       The pthreadsetintr() function atomically sets the calling thread's
       cancellability (interruptibility) state to the indicated state and
       returns the previous cancellability state.  This function creates a
       cancellation (interruption) point in the calling thread, if the state
       is being enabled.  When cancellability is disabled for the calling
       thread, it may not accept a pending cancellation.  A newly created
       thread has cancellability enabled.

       The pthreadsetintrtype() function atomically sets the calling
       thread's cancellability (interruptibility) type to the indicated type
       and returns the previous cancellability type.  The cancellability
       type can be either controlled or asynchronous.  Controlled
       cancellability (default upon thread creation) indicates that
       cancellation can only occur at certain cancellation (interruption)
       points in the thread's execution.  These cancellation points are
       enumerated well in Draft 8 of the Posix 1003.4a standard, and the
       list continues to evolve.

       Asynchronous cancellability indicates that cancellation can occur at
       any place in the thread's execution.  Asynchronous cancellability is
       generally dangerous and should be avoided, except in cases where a
       thread is off on its own, executing a long computation.

       The pthreadtestintr() function creates an explicit cancellation
       point in the calling thread.  This function has no effect if
       cancellability is disabled.

       Cancellability state and type do not apply to a thread's handling of
       signals.  Signals can be handled at any time.  Hence signals are
       quite dangerous in multithreaded programs and should be avoided.
       When signals must be handled, it is recommended that a dedicated
       thread be used to synchronously wait for a signal with sigwait(2).

DIAGNOSTICS
   Return Value
       If successful, pthreadsetintr() and pthreadsetintrtype()
       respectively return the previous cancellability state and type.
       Otherwise, they return -1 and set errno to indicate the error.

   Errors
       For each of the following conditions, pthreadsetintr() returns -1
       and sets errno to the corresponding value:

       [EINVAL]  The specified state is not PTHREAD_INTR_ENABLE or
                 PTHREAD_INTR_DISABLE.

       For each of the following conditions, pthreadsetintrtype() returns
       -1 and sets errno to the corresponding value:

       [EINVAL]  The specified type is not PTHREAD_INTR_CONTROLLED or
                 PTHREAD_INTR_ASYNCHRONOUS.

SEE ALSO
       pthreadcancel(3T), pthreadcleanuppush(3T),
       pthreadcleanuppop(3T), threads(5), sigwait(2).

NOTES
       The terms "cancellation" and "interruption" are equivalent.  Later
       drafts of the standard use "cancellation point" instead of
       "interruption point."  Draft 8 gives a fairly complete listing of all
       standard cancellation points.

       The use of asynchronous cancellability is extremely discouraged, as a
       thread can never be sure out of which function it was canceled.  For
       example, the canceled thread may be unaware that it owns a critical
       mutex from one of the standard libraries.  If it terminates, other
       threads trying to obtain the mutex will deadlock.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026