Boost logo

Boost Users :

Subject: Re: [Boost-users] [Signals] trackable detection for user defined callabcks
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2011-10-28 10:35:54


>>
>> 1) What is the required interface for user-defined callbacks?
>
> Hehe it is:
> http://www.boost.org/doc/libs/1_47_0/doc/html/boost/signals/trackable.html

Ah, so I should provide appropriate visit_each() overload for my callback type?
Can't say I understand what it is suppose to do tho. Example for Boost.Function
would be great ;)

>
>> 2) Is it still true that it will be addressed in future versions of
>> Boost.Function?
>
> You've got now Signals2, which allows using weak_ptr for tracking purposes.

Signals2 requires objects to be managed by shared_ptr which imho is more
intrusive (in a sense of class design enforcement) than original Signals. My
objects are kept in ptr_ and intrusive containers and it is trivial to make
them trackable but impossible to make them being managed by shared_ptr.
Additionally, within specific sub-systems signal-slot connections are
single-threaded and using:

namespace bs2 = boost::signals2;
using bs2::keywords;
bs2::signal_type<void (int), mutex_type<bs2::dummy_mutex> >::type sig;

instead of:

signal<void(int)> sig;

especially multiple times in single class definition is just horrible. Or am I
missing some easy way to redefine default mutex?

Cheers,
Simon


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