177 or only at cancellation points.
178
179
180 With the default type of PTHREAD_CANCEL_DEFERRED, the thread is
181 cancelable only at cancellation points, and then only when cancellation
182 is enabled.
183
184
185 If the type is PTHREAD_CANCEL_ASYNCHRONOUS, the thread is cancelable at
186 any point in its execution (assuming, of course, that cancellation is
187 enabled). Try to limit regions of asynchronous cancellation to
188 sequences with no external dependencies that could result in dangling
189 resources or unresolved state conditions. Using asynchronous
190 cancellation is discouraged because of the danger involved in trying to
191 guarantee correct cleanup handling at absolutely every point in the
192 program.
193
194
195
196
197 +------------------------------+------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
198 |Cancellation Type/State Table | | |
199 |Type | State | |
200 | | Enabled (Default) | Disabled |
201 +------------------------------+------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
202 |Deferred (Default) | Cancellation occurs when the target thread reaches a cancellation point and a cancel is pending. (Default) | All cancellation requests to the target thread are held pending. |
203 |Asynchronous | Receipt of a pthread_cancel() call causes immediate cancellation. | All cancellation requests to the target thread are held pending; as soon as cancellation is re-enabled, pending cancellations are executedimmediately. |
204 +------------------------------+------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
205
206 Cancel-Safe
207 With the arrival of POSIX cancellation, the Cancel-Safe level has been
208 added to the list of MT-Safety levels. See attributes(5). An
209 application or library is Cancel-Safe whenever it has arranged for
210 cleanup handlers to restore system or program state wherever
211 cancellation can occur. The application or library is specifically
212 Deferred-Cancel-Safe when it is Cancel-Safe for threads whose
213 cancellation type is PTHREAD_CANCEL_DEFERRED. See Cancellation State.
214 It is specifically Asynchronous-Cancel-Safe when it is Cancel-Safe for
215 threads whose cancellation type is PTHREAD_CANCEL_ASYNCHRONOUS.
216
217
218 It is easier to arrange for deferred cancel safety, as this requires
219 system and program state protection only around cancellation points. In
220 general, expect that most applications and libraries are not
221 Asynchronous-Cancel-Safe.
222
223 POSIX Threads Only
224 The cancellation functions described in this manual page are available
|
177 or only at cancellation points.
178
179
180 With the default type of PTHREAD_CANCEL_DEFERRED, the thread is
181 cancelable only at cancellation points, and then only when cancellation
182 is enabled.
183
184
185 If the type is PTHREAD_CANCEL_ASYNCHRONOUS, the thread is cancelable at
186 any point in its execution (assuming, of course, that cancellation is
187 enabled). Try to limit regions of asynchronous cancellation to
188 sequences with no external dependencies that could result in dangling
189 resources or unresolved state conditions. Using asynchronous
190 cancellation is discouraged because of the danger involved in trying to
191 guarantee correct cleanup handling at absolutely every point in the
192 program.
193
194
195
196
197 +------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
198 |Cancellation Type/State Table | | |
199 |Type | State | |
200 | | Enabled (Default) | Disabled |
201 +------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
202 |Deferred (Default) | Cancellation occurs when the target thread reaches a cancellation point and a cancel is pending. (Default) | All cancellation requests to the target thread are held pending. |
203 |Asynchronous | Receipt of a pthread_cancel() call causes immediate cancellation. | All cancellation requests to the target thread are held pending; as soon as cancellation is re-enabled, pending cancellations are executed immediately. |
204 +------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
205
206 Cancel-Safe
207 With the arrival of POSIX cancellation, the Cancel-Safe level has been
208 added to the list of MT-Safety levels. See attributes(5). An
209 application or library is Cancel-Safe whenever it has arranged for
210 cleanup handlers to restore system or program state wherever
211 cancellation can occur. The application or library is specifically
212 Deferred-Cancel-Safe when it is Cancel-Safe for threads whose
213 cancellation type is PTHREAD_CANCEL_DEFERRED. See Cancellation State.
214 It is specifically Asynchronous-Cancel-Safe when it is Cancel-Safe for
215 threads whose cancellation type is PTHREAD_CANCEL_ASYNCHRONOUS.
216
217
218 It is easier to arrange for deferred cancel safety, as this requires
219 system and program state protection only around cancellation points. In
220 general, expect that most applications and libraries are not
221 Asynchronous-Cancel-Safe.
222
223 POSIX Threads Only
224 The cancellation functions described in this manual page are available
|