gpt4 book ai didi

c++ - boost是如何实现信号和槽的?

转载 作者:行者123 更新时间:2023-11-28 03:59:49 25 4
gpt4 key购买 nike

继续另一个问题,让我们问这个:

Boost是如何实现signals/slot机制的?

参见: How signal and slots are implemented under the hood? http://www.boost.org/doc/libs/1_40_0/doc/html/signals.html

最佳答案

这里有一段来自 this gamedev.net thread 的有趣片段,可以插入讨论

Original post by Spoonbender So, bonus question: What causes boost::signals to be that much slower?

It looks like there are a couple of biggies. First, despite the fact that boost::signals isn't threadsafe, it enters and leaves critical sections a couple of times. Secondly, there's this named-slots thingy which seems to result in overly complex data structures which take a long time to iterate over. And then there's a lot of nickel-and-diming from various housekeeping things it does. Finally, the individual calls have much higher overhead because of boost::bind's runtiminess. It's all functionality that I'm sure someone has a need for, but I don't.

关于c++ - boost是如何实现信号和槽的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1413777/

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