When is POSIX thread cancellation not immediate?
问题 The POSIX specifies two types for thread cancellation type: PTHREAD_CANCEL_ASYNCHRONOUS , and PTHREAD_CANCEL_DEFERRED (set by pthread_setcanceltype(3) ) determining when pthread_cancel(3) should take effect. By my reading, the POSIX manual pages do not say much about these, but Linux manual page says the following about PTHREAD_CANCEL_ASYNCHRONOUS : The thread can be canceled at any time. (Typically, it will be canceled immediately upon receiving a cancellation request, but the system doesn't