在Boost.Thread 3.0.0重大更改 [英] Breaking changes in Boost.Thread 3.0.0
问题描述
在的Boost库的1.50.0版本的发行说明我注意到2重大更改(的看到这里):
In the release notes of version 1.50.0 of the Boost libraries I noted two breaking changes (see here):
#6266重大更改:线程析构函数应该调用终止,如果可连接
#6266 Breaking change: thread destructor should call terminate if joinable.
#6269重大更改:螺纹移动分配应调用终止,如果连接的。
#6269 Breaking change: thread move assignment should call terminate if joinable.
这是什么意思为目前使用Boost 1.49.0我现有的项目?我一定要改变什么?如果是的话,我有什么确切的变化?会发生什么,如果我忘记修改我现有的项目之一?我会得到编译时错误(我希望如此),否则我会变得肮脏和难以找到运行时的问题(我绝对不希望如此)?
What does this mean for my existing projects currently using Boost 1.49.0? Do I have to change anything? If yes, what do I have to change exactly? And what happens if I forget to modify one of my existing projects? Will I get compile time errors (I hope so) or will I get nasty and hard-to-find runtime problems (I absolutely don't hope so)?
推荐答案
当它说:重大更改,这意味着,如果你依赖的行为这是previously X您的计划被打破,但现在是ÿ
When it says "Breaking change", it means, "Your program is broken if you depend on behaviour which was previously X, but is now Y".
对于给定的两个变化,这意味着如果你依赖析构函数或移动分配调用加入()
(或分离()
),我相信是previous的行为,你的程序现在必须明确加入()
或分离()
或满足您的朋友的std ::终止()
。这不是一个编译时错误,但也不是联合国predictable运行时behaviour-你会得到一个干净的崩溃导致右后卫的boost ::线程
的析构函数,这是问题的根源。
For the given two changes, it means that if you rely on the destructor or move assignment calling join()
(or detach()
), which I believe was the previous behaviour, your program must now explicitly join()
or detach()
or meet your friend std::terminate()
. It's not a compile-time error, but nor is it unpredictable run-time behaviour- you'll get a nice clean crash leading right back to boost::thread
's destructor, which is the cause of the problem.
这篇关于在Boost.Thread 3.0.0重大更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!