stevenliyong 的专栏

pthread_testcancel()–Create Cancellation Point

Syntax#include <pthread.h>void pthread_testcancel(void);Threadsafe: YesSignal Safe: No

The pthread_testcancel() function creates a cancellation point in the calling thread. If cancelability is currently disabled, this function has no effect. For more information on cancelability, see Thread cancellation APIs.

When cancelability is disabled, all cancels are held pending in the target thread until the thread changes the cancelability. When cancelability is deferred, all cancels are held pending in the target thread until the thread changes the cancelability, calls a function that is a cancellation point, or calls pthread_testcancel(), thus creating a cancellation point. When cancelability is asynchronous, all cancels are acted upon immediately, interrupting the thread with its processing.

You should not use asynchronous thread cancellation via the PTHREAD_CANCEL_ASYNCHRONOUS option of pthread_setcanceltype(). See the common user errors section of this document for more information.

,梦想,并不奢侈,只要勇敢地迈出第一步。

stevenliyong 的专栏

相关文章:

你感兴趣的文章:

标签云: