

#Terminate pthread c code
This means that pthread_testcancel does not contain cancellation points, but it needs to create a cancellation point where cancellation points are not included to respond to cancellation requests in an execution code thread that does not contain cancellation points.

Setting the execution time of this thread's cancel action, the type is selected by two values: PTHREAD_CANCEL_DEFFERED and PTHRAD_CANCEL_ASYCHRONOUS, which are valid only when the Cancel state is Enable, indicating that the cancel action will continue to run to the next cancel point after receiving the signal, then exit and immediately execute the cancel action (exit) if the oldtype is not NULL, the cancel action type value will be stored in the shipment. int pthread_setcanceltype( int type, int *oldtype) Indicates that after receiving the signal, the CANCLED state is set and the CANCEL signal is ignored to continue running if old_state is not NULL, it will be stored in the original Cancel state for recovery.Ĭ. Setting the thread's response to Cancel signals, state has two values: PTHREAD_CANCEL_ENABLE (default) and PTREAD_CANCEL_DISABLE. int pthread_setcancelstate( int state, int *oldstate) Successful sending does not mean that threads terminate.ī. Send a termination signal to the thread thread and return 0 if successful, otherwise it is not zero.
