Re: copying sigc::signals

On Fri, 05 Mar 2010 10:40:52 -0600
Jonathon Jongsma <jonathon quotidian org> wrote:
> On Fri, 2010-03-05 at 14:15 +0000, Chris Vine wrote:
> > 
> > It is probably better simply to disallow copying of signals, rather
> > than do shallow copies resulting in the curious effects you
> > mention.  I took that line when writing some signal/slot classes of
> > my own for use where libsigc++ was not suitable because it is not
> > thread safe.  (But these also happen to implement trackability at
> > the signal level.)
> I think this would be my preferred solution as well, though I haven't
> really considered what all the effects of that would be.  In any
> case, I don't think the behavior is likely to change in the near
> future, so I just wanted people to be aware of the issue.

The alternative I suppose is for slots to have a reference counting
implementation allowing them to be shared amongst signals (so the slots
have shallow copying, which should be OK, rather than the signals,
where it isn't).  But that has efficiency implications (and causes yet
further thread safety issues).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]