Boost logo

Boost Users :

From: Timmo Stange (ts_at_[hidden])
Date: 2007-02-01 11:24:00


Frank Mori Hess wrote:

> I hit the same problem, I had to manually disconnect at the beginning of my
> destructors, see
>
> http://article.gmane.org/gmane.comp.lib.boost.user/24356

Thanks, I must have missed that post of yours and feel a little stupid
about raising the same question again now ;).

> Thread-safe automatic disconnect from non-static member functions seems
> like it would require some kind of extension to the language itself, like
> a pre-destructor.

There is also the possibility of using a wrapper template instead of
a base class to put the tracking functionality to the top of the class
hierarchy, but I don't think I particularly like that approach,
especially as measures to "finalize" the hierarchy would have to be
taken.

> I recently did the same thing as you, my signals implementation is
> attached, if you are interested. The namespaces are different in my
> code, ::boost is ::EPG and ::boost::signals is ::EPG::signalslib.

Thanks for the code, it looks very promising. I was hoping it could be
done with a little less runtime overhead (per slot mutex + polymorphism
+ shared_ptr), but I have to investigate the available options some
more.

I have one small suggestion for now: You could perhaps move the
connection mutex to the base class to avoid too much per-Signature
code repetition (use a private virtual do_disconnect() for forwarding,
for example).

Regards

Timmo Stange


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net