How does boost implements signals and slots?

孤人 提交于 2020-01-11 04:19:25

问题


To continue another question, lets ask this:

How does Boost implement the signals/slot mechanism?

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


回答1:


here's an interesting snippet from this gamedev.net thread to get the discussion rolling

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.



来源:https://stackoverflow.com/questions/1413777/how-does-boost-implements-signals-and-slots

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!