Use case for std::promise::set_{value|exception}_at_thread_e
Use case for std::promise::set_{value|exception}_at_thread_exit
我什么时候必须使用std::promise::set_value_at_thread_exit
/std::promise::set_exception_at_thread_exit
而不是std::promise::set_value
/std::promise::set_exception
?
唯一的区别是,前者保证仅在调用线程的thread_local
被销毁后才使关联的未来准备就绪。但是,我想不出任何非合成示例会很有用。
一件事可能是知道一个分离的线程是否已经完成运行,当你的程序仍然处于它关心知道的状态时。
相关文章:
- 如何处理来自核心指南检查器的关于gsl::at的静态分析警告
- 为重写std::exception的库生成swig接口时出错
- 什么是 std::exception::what() 以及为什么要使用它?
- "CID"在AT+HTTPPARA= "CID" ,1中是什么意思
- 链表"exception thrown"
- 为什么程序员同时使用 std::bad_alloc 和 std::exception.是否 std::例外 仅是不够的
- 在C++中使用 Catch 测试框架编译错误"error: expected ';' at end of declaration list"
- CMake 用于设定C++标准的设施 "at least C++NN"
- SIGSEGV on Boost UDP 套接字关闭 - tcache_get at malloc.c.
- 使用 mat.at<uchar>(i,j) 的 opencv C++中的矩阵赋值错误
- CMake Error at modules/videoio/cmake/detect_ffmpeg.cmake:16
- 当键值是 std 向量时,为什么使用 at in C++ 访问映射值如此缓慢?
- 两个垫子的 OpenCV 数据是相同的,但使用 Mat::at 检索时的值已损坏
- C++ broken_promise exception
- 使用 at() 访问 std::map 元素是否比运算符 [] 慢?
- 如何找出导致"cv::Exception at memory location"的原因?
- "First-chance exception at 0x00000000" 我做错了什么?
- openCV 中的 SVM 抛出"cv::Exception at memory location"
- 我收到此错误"Unhandled exception at 0x009437bd in Hash functions.exe: 0xC0000005: Access violation reading
- 矢量存储限制的向量 - 获得"Microsoft C++ exception: std::bad_alloc at memory location 0x0031650C."错误