We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
std::jthread
libc++
1 parent 7453f85 commit 5808f66Copy full SHA for 5808f66
md/02使用线程.md
@@ -919,6 +919,8 @@ int main(){
919
}
920
```
921
922
+> [运行](https://godbolt.org/z/dz43PT51c)测试。截止目前(`2024/5/29` clang19 未发布) `libc++` 不完全支持 `std::jthread`,建议使用 `clang` 的开发者链接 `libstdc++` 或 `MSVC STL` 进行编译。如果非要使用 `libc++`,可以添加 [`-fexperimental-library`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fexperimental-library) 编译选项,启用不稳定库功能和实验库功能。这样,我们的这段代码就可以通过编译。
923
+
924
`std::jthread` 提供了三个成员函数进行所谓的**线程停止**:
925
926
- `get_stop_source`:返回与 `jthread` 对象关联的 `std::stop_source`,允许从外部请求线程停止。
0 commit comments