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

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

问题描述

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

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.

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

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

推荐答案

嗯...

第一个有趣的是,名称中的 -mt 修饰符是表示该库可以用于多线程.这可能会让我们相信 boost_thread(没有这个修饰符)可能是多线程不安全的......

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...

但实际情况是(在我自己的 Ubuntu 10.04 机器上看到的),boost_thread 是到 boost_thread-mt 的软链接,这意味着两者是一个也一样.

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.

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

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

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

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

ls -l ./libboost_thread*

这将列出所有以 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

如您所见,libboost_thread.a 是静态库,libboost_thread-mt.alibboost_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天全站免登陆