gpt4 book ai didi

c++ - Boost.Signals 弃用

转载 作者:行者123 更新时间:2023-11-30 02:52:58 24 4
gpt4 key购买 nike

Boost.Signals is no longer being actively maintained, so it has been deprecated. Do not use Boost.Signals for new development (use Boost.Signals2 instead). If you have existing Boost.Signals-based code, it will continue to work, but consider moving to Boost.Signals2.

http://www.boost.org/users/history/version_1_54_0.html

因此,信号已被弃用。我对此感到困惑。据我所知,Signals2 是 Signals 的多线程版本。但是如果我不需要信号的多线程使用呢?我会得到一些开销吗?我可以使用 boost::signals2::trackable 吗?在单线程应用程序中使用 Signals2 会有什么缺点吗?

最佳答案

As far as I know, Signals2 is multi-threaded version of Signals. But what if I don't need multi-threading usage of Signals? Will I get some overhead?

在单线程环境中使用dummy_mutex,如described here .

Can I use boost::signals2::trackable?

是的,您可以使用它,但请记住它不会是 thread-safe approach .因此,如果您最终决定将模块调整为多线程环境,则必须重新设计插槽。

关于c++ - Boost.Signals 弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18417121/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com