OSF DCE Application Development Guide--Core Components
OSF DCE Application Development Guide—Core Components
processes that do not have specific places for cancel requests. Asynchronous
cancelability is disabled by default. Disable asynchronous cancelability when calling
threads routines or any other runtime library routines that are not explicitly documented
as cancel-safe.
Note: If general cancelability is disabled, the thread cannot be canceled,
regardless of whether asynchronous cancelability is enabled or disabled.
The setting of asynchronous cancelability is relevant only when general
cancelability is enabled.
Use the following routines to control the canceling of threads:
• The pthread_setcancel( ) routine to enable and disable general cancelability
• The pthread_testcancel( ) routine to request delivery of a pending cancel to the
current thread
• The pthread_setasynccancel() routine to enable and disable asynchronous
cancelability
• The pthread_cancel( ) routine to request that a thread be canceled
7.8 Thread Scheduling
Threads are scheduled according to their scheduling priority and how the scheduling
policy treats those priorities. To understand the discussion in this section, you must
understand the concepts in the following sections of this chapter:
• Section (7.3.3.1) discusses scheduling policies, including the way in which each
policy handles thread scheduling priority.
• Section (7.3.3.2) discusses thread scheduling priorities.
• Section (7.3.3.3) discusses inheritance of scheduling attributes by created threads.
To specify the minimum or maximum priority, use the appropriate symbol; for example,
PRI_OTHER_MIN or PRI_OTHER_MAX. To specify a value between the minimum
and maximum priority, use an appropriate arithmetic expression.
For example, to specify a priority midway between the minimum and maximum for the
default scheduling policy, specify the following concept using your programming
language’s syntax:
pri_other_mid = (PRI_OTHER_MIN + PRI_OTHER_MAX)/2
If your expression results in a value outside the range of minimum to maximum, an error
results when you use it. Priority values are integers.
To show results of the different scheduling policies, consider the following example: a
program has four threads, called threads A, B, C, and D. For each scheduling policy,
three scheduling priorities have been defined: minimum, middle, and maximum. The
threads have the priorities shown in Table 7-1.
7− 14 Tandem Computers Incorporated 124245