|
Boost : |
From: Frantz Maerten (frantz.maerten_at_[hidden])
Date: 2005-02-11 18:17:28
I took a look at libsidc++ and found very interresting the way of
blocking/unblocking connections.
I added some small modifications in boost::signals lib in order to have this
functionality (2 patches in attachment to apply at the parent of the
boost_1_32_0 distrib).
Only the interface of connection has changed (3 new
methods), and I added a boolean flag in basic_connection struct.
Also, a functor is_callable was added in the file connection.hpp, in replacement
of the is_disconnected functor (used in the class slot_call_iterator).
So, my questions are:
1) is it interresting/useful to incorporate it (for me, yes of course)?
2) is it a safe implementation?
You can test it like that:
\code
void fct1(int) ;
void fct2(int) ;
MySignal sig ;
boost::signals::connection conn = sig.connect(&fct1) ;
sig(10) ; // call fct1 and fct2
conn.block() ;
sig(20) ; // call only fct2
conn.unblock() ;
sig(30) ; // call fct1 and fct2
\endcode
--Frantz
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk