Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pthread_setcancel(3-thr) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

pthread_setcancel(3-thr)                           pthread_setcancel(3-thr)

NAME
     pthreadsetcancel - enables or disables the current thread's general
     cancelability

SYNOPSIS
     #include <pthread.h>

     int pthreadsetcancel(int state);

PARAMETERS
     state     State of general cancelability set for the calling thread.
               On return, receives the prior state of general cancelabil-
               ity. Valid values are as follows:

               CANCELON    General cancelability is enabled.

               CANCELOFF   General cancelability is disabled.

DESCRIPTION
     The pthreadsetcancel() routine enables or disables the current
     thread's general cancelability and returns the previous general cance-
     lability state.

     When general cancelability is set to CANCELOFF, a cancel cannot be
     delivered to the thread, even if a cancelable routine is called or
     asynchronous cancelability is enabled.

     When a thread is created, the default general cancelability state is
     CANCELON.

   Possible Dangers of Disabling Cancelability
     The most important use of cancels is to ensure that indefinite wait
     operations are terminated. For example, a thread waiting on some net-
     work connection, which may take days to respond (or may never
     respond), is normally made cancelable.

     However, when cancelability is disabled, no routine is cancelable.
     Waits must be completed normally before a cancel can be delivered. As
     a result, the program stops working and the user is unable to cancel
     the operation.

     When disabling cancelability, be sure that no long waits can occur or
     that it is necessary for other reasons to defer cancels around that
     particular region of code.

RETURN VALUES
     On successful completion, the previous state of general cancelability
     is returned. If the function fails, -1 is returned. Following are the
     possible return values and the possible corresponding values (if any)
     for errno:





Page 1                       Reliant UNIX 5.44                Printed 11/98

pthread_setcancel(3-thr)                           pthread_setcancel(3-thr)

     CANCELON    General cancelability was on.

     CANCELOFF   General cancelability was off.

     EINVAL       The specified state is not CANCELON or CANCELOFF.

SEE ALSO
     pthreadcancel(3-thr), pthreadsetasynccancel(3-thr),
     pthreadtestcancel(3-thr).













































Page 2                       Reliant UNIX 5.44                Printed 11/98

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