Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-02-11 09:51:48


Douglas Gregor wrote:
> Background: Signals performance is sub-par, and much of the problem
> can be traced back to support for named slot groups. I'm trying to
> determine the best way to proceed.

Are you sure that this is the case?

Last time I looked, alternatives beat Boost.Signals because they don't
handle the corner cases of slot disconnection during signal invocation.

Example:

    R operator()(void) const
    {
        typename list::iterator i = list_.begin();
        while (i != list_.end())
        {
            if (i->function_)
            {
                (i++)->function_();
            }
            else
            {
                i = list_.erase(i);
            }
        }
    }

(from Jody Hagins's implementation)

AFAICS this doesn't work if (i++)->function_() disconnects *(i+1).

To handle disconnection correctly, one needs to invoke a temporary list<>. I
haven't looked at what boost::signal does, but this may account for the
dynamic allocations that have been reported.

Of course named slot groups may introduce additional overhead, I don't know.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk