Boost.Thread链接 - boost_thread与boost_thread-mt [英] Boost.Thread Linking - boost_thread vs. boost_thread-mt

查看:480
本文介绍了Boost.Thread链接 - boost_thread与boost_thread-mt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不清楚 Boost有哪些链接选项.Thread 1.34.1 库。我在Ubuntu 8.04上,我发现在链接编译期间使用 boost_thread boost_thread-mt 并运行,但我没有看到任何关于这些或任何其他链接选项上的链接文件。



什么Boost.Thread链接选项可用,它们是什么意思?

解决方案

那么第一个有趣的事情是名称中的 -mt 修饰符用于指示该库对于多线程是正常的。这可能导致我们认为 boost_thread (没有这个修饰符)可能是多线程不安全的......



但是真正的事情是(如我在Ubuntu 10.04中看到的那样), boost_thread 是一个到 boost_thread-mt ,这意味着两者是相同的。



如果你想验证它,你可以在你的ubuntu上打开一个控制台(使控制台全屏,因为名称然后输入:

  cd / usr / lib 

移动到Boost库所在的目录。然后:

  ls -l ./libboost_thread* 

其中将列出以 libboost_thread 开头的所有文件以及其他信息。结果将如下所示:

  [...] ./libboost_thread.a 
[...] ./libboost_thread-mt.a - > libboost_thread.a

正如您所见, libboost_thread.a 是一个静态库, libboost_thread-mt.a 是一个到 libboost_thread.a


It's not clear to me what linking options exist for the Boost.Thread 1.34.1 library. I'm on Ubuntu 8.04 and I've found that when using either boost_thread or boost_thread-mt during linking both compile and run, but I don't see any documentation on these or any other linking options in above link.

What Boost.Thread linking options are available and what do they mean?

解决方案

Well...

The first amusing thing is that the -mt modifier in the name is to indicate the library is Ok for multithreading. Which could lead us to believe that boost_thread (without this modifier) could be multithread-unsafe...

But the real thing is that (as seen on my own Ubuntu 10.04 box), boost_thread is a soft link to boost_thread-mt, which means the two are one and the same.

If you want to verify it, you can open a console on your ubuntu (make the console fullscreen because the names are long), then type:

cd /usr/lib

to move to the directory where the Boost libraries are. And then:

ls -l ./libboost_thread*

Which will list all the files starting with libboost_thread, with additionnal information. The result will be something like:

[...] ./libboost_thread.a
[...] ./libboost_thread-mt.a -> libboost_thread.a

As you can see, libboost_thread.a is a static library, and libboost_thread-mt.a is a soft link to libboost_thread.a

这篇关于Boost.Thread链接 - boost_thread与boost_thread-mt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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