多线程感知模式下的 BOOST 库

BOOST libraries in multithreading-aware mode(多线程感知模式下的 BOOST 库)
本文介绍了多线程感知模式下的 BOOST 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在所谓的线程感知模式下编译 BOOST 库.如果是这样,您将看到...-mt..."出现在库名称中.我不明白它给了我什么,我什么时候需要使用这种模式?它能给我带来什么好处吗?

There is a possibility to compile BOOST libraries in the so-called thread-aware mode. If so you will see "...-mt..." appeared in the library name. I can't understand what it gives me and when do I need to use such mode? Does it give me any benefits?

不仅如此,我对在无线程感知机制(名称中没有 -mt)中编译 BOOST Threads 库感到非常困惑.这对我来说没有任何意义.看起来自相矛盾:/

More than that I'm really confused by having BOOST Threads library compiled in NO-thread-aware regime (with no -mt in the name). It does not make any sense for me. Looks self-contradictory :/

非常感谢您的帮助!

推荐答案

因为你没有说明你是如何构建的,在什么平台上,我会解释整个故事.在 Linux 和 Windows 上,Boost.Thread 库都是以 MT 模式构建的.在 Windows 上,默认情况下,您会获得 -mt 后缀.在 Linux 上,默认情况下在 1.42 中,您没有后缀.在 Linux 上没有后缀的原因是几乎没有其他库使用这种约定,无论如何它在 Linux 上都不那么重要.

Because you did not specify how you have built, and on what platform, I'll explain the whole story. Both on Linux and Windows, Boost.Thread library is built in MT mode. On Windows, by default, you get -mt suffix for it. On Linux, by default in 1.42, you get no suffix. The reason you get no suffix on Linux is that pretty much no other library uses such convention, and it's much less important on Linux anyway.

这能说明问题吗?

这篇关于多线程感知模式下的 BOOST 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Event / Task Queue Multithreading C++(事件/任务队列多线程 C++)
Design Pattern, Qt Model/View and multiple threads(设计模式、Qt 模型/视图和多线程)
Do I need to protect read access to an STL container in a multithreading environment?(在多线程环境中是否需要保护对 STL 容器的读取访问?)
SFML fails in multithreading(SFML 在多线程中失败)
Random numbers for multiple threads(多线程的随机数)
Boost weak_ptr#39;s in a multi-threaded program to implement a resource pool(多线程程序中boostweak_ptr实现资源池)