---
title: "Discussion on \"pthread_cancel 與解構子行為實驗\" | Hashnode"
description: "Discussion on \"pthread_cancel 與解構子行為實驗\". Manual\npthread_cancel(3) - Linux manual page\n根據 linux manual 所寫，pthread_cancel 基本上可以在一些可中斷的地方（POSIX 給了一個清單，大概是 IO 操作的時候）中斷 thread。\n這時就好奇了：C++ 的 Destructor 會不會被觸發？這並沒有寫在文件上。\nCode\n#include <pthread.h>\n#"
url: "https://hashnode.com/posts/pthread-cancel-and-destructor/655f5ed35dac36aae2e266b4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [pthread\_cancel 與解構子行為實驗](https://notes.mukyu.dev/pthread-cancel-and-destructor?utm_source=hashnode&utm_medium=feed)

Manual pthread\_cancel(3) - Linux manual page 根據 linux manual 所寫，pthread\_cancel 基本上可以在一些可中斷的地方（POSIX 給了一個清單，大概是 IO 操作的時候）中斷 thread。 這時就好奇了：C++ 的 Destructor 會不會被觸發？這並沒有寫在文件上。 Code #include <pthread.h> #

Nov 23, 2023 · 2 min read · notes.mukyu.dev  
Updated Oct 27  
Read the article

-   [#c](https://hashnode.com/tag/c)
-   [#linux](https://hashnode.com/tag/linux)
-   [#threads](https://hashnode.com/tag/threads)

## Written by

[Patchouli](https://hashnode.com/@mudream4869)

@mudream4869 · Uohout

  
[View profile](https://hashnode.com/@mudream4869)

工程師帕秋莉~

後端工程師。 不定時張貼一些寫扣時的筆記，有時英文，有時中文。 「如果，我是魔女的話...」

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
