lotus

previous page: 10. (DCE, POSIX, UI) Why does my threaded program not handle signals sensibly? (Programming)
  
page up: Threads Programming FAQ
  
next page: 12. Why are reentrant library and system call interfaces good? (Programming threads)

11. (DCE?, POSIX) Why does everyone tell me to avoid asynchronous cancellation? (Programming threads)




Description

This article is from the Threads Programming FAQ, by Bryan O'Sullivan bos@serpentine.com with numerous contributions by others.

11. (DCE?, POSIX) Why does everyone tell me to avoid asynchronous cancellation? (Programming threads)

Asynchronous cancellation of threads is, in general, evil. The reason
for this is that it is usually (very) difficult to guarantee that the
recipient of an asynchronous cancellation request will not be in a
critical section. If a thread should die in the middle of a critical
section, this will very likely cause your program to misbehave.

Code that can deal sensibly with asynchronous cancellation requests is
"not" referred to as async-safe; that means something else (see the
terminology section of the FAQ). You won't see much code around that
handles asynchronous cancellation requests properly, and you shouldn't
try write any of your own unless you have compelling reasons to do so.
Deferred cancellation is your friend.

 

Continue to:













TOP
previous page: 10. (DCE, POSIX, UI) Why does my threaded program not handle signals sensibly? (Programming)
  
page up: Threads Programming FAQ
  
next page: 12. Why are reentrant library and system call interfaces good? (Programming threads)