我应该preFER的std ::线程或Boost线程? [英] Should I prefer std::thread or Boost threads?

查看:140
本文介绍了我应该preFER的std ::线程或Boost线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的C ++(从C#来)写一个多线程的C ++应用程序,并想知道什么是更好地利用:的std ::线程或助推对应?

I'm new to C++ (coming from C#) writing a multi-threaded C++ application and wondering what is better to use: std::thread or its Boost counterpart?

我看到了<一个href=\"http://stackoverflow.com/questions/7241993/is-it-smart-to-replace-boostthread-and-boostmutex-with-c11-equivalents\">following在另一个堆栈溢出后讨论,但还是没有的,为什么我要选择一个比其他的全貌。如果没有启动一个新的程序,我应该使用标准库或Boost线程?

I saw the following discussion in another Stack Overflow post, but still do not have the complete picture of why should I choose one over the other. If not starting a new program, should I use standard library or Boost threads?

谢谢!

推荐答案

如果你不是已经在项目中使用升压,没有理由使用boost ::线程支持的std ::线程。也就是说,除非你正在使用从STL无法提升一些功能。的std ::线程是足够适合大多数使用情况下,除非有力的论据是presented,书写标准code总是preferable。

If you're not already using boost in your project, there is no reason to use boost::thread in favor of std::thread. That is unless you are using some feature from boost not available in the STL. std::thread is suitable enough for most use cases, and unless compelling arguments are presented, writing standard code is always preferable.

如果您已经在项目中使用升压然而,检查一下的boost ::线程提供任何额外的东西比较的std ::线程。

If however you are already using boost in your project, check out if boost::thread offers anything extra compared to std::thread.

这篇关于我应该preFER的std ::线程或Boost线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆