Silphireの日記: pthread日記(76) - pthread_setcanceltype()
日記 by
Silphire
スレッドのキャンセルタイプを設定します
int pthread_setcanceltype(int type, int *oldtype);
pthread_setcanceltype()は、呼び出したスレッドのキャンセル状態をtypeにし、元のキャンセル状態をoldtypeに格納します。typeには、PTHREAD_CANCEL_DEFERREDかPTHREAD_CANCEL_ASYNCHRONOUSを与えます。
新しく出来たスレッドのキャンセル状態はPTHREAD_CANCEL_DEFERREDです。main()が最初に起動したスレッドも同様です。
pthread_setcanceltype()が成功した時には0を返します。エラーの時はエラーに応じた値を返します。
pthread日記(76) - pthread_setcanceltype() More ログイン