Subject: Re: [boost] [Signals2] Using dummy_mutex in a multithreaded program
From: Peter Petrov (ppetrov_at_[hidden])
Date: 2010-01-18 15:25:04
On Mon, Jan 18, 2010 at 8:53 PM, Helge Bahmann <hcb_at_[hidden]> wrote:
> not a direct answer to your question, but if signals2 is posing performance
> problems to you, you might want to check out my alternate signal/slot
> It provides the same interface as "signals2", but...
> - it is always thread-safe (no dummy-mutex mode because there is simply no
> need to ever do that)
> - it is three(!) times as fast as thread-unsafe "signals"
> - it is five(!) times as fast as "signals2" with a real mutex
> It makes extensive use of atomic operations to achieve that -- for your
> use-case, it adds an overhead of exactly one pair of atomic inc/dec
> operations for every notification through the signal over an "open-coded"
> linked list of boost::function objects.
In this specific case I've already solved my issue by writing a minimal
signal class which mimics the signals2 interface and implements only what I
really need. I'll definitely have your library in mind when the need for
something more complex arises.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk