Boost logo

Boost Users :

Subject: [Boost-users] [signals2] connection blocking
From: Bryan Green (bryan.d.green_at_[hidden])
Date: 2009-05-15 20:54:07


I've starting porting some code from signals to signals2, and I've run into
a problem because of the removal of the 'block' and 'unblock' methods from a
connection object. I understand the rational for using the
'shared_connection_block' object, but it doesn't really apply in my case.

I have a GUI widget which receives events via a signal, unless it is in an
"inactive" state, during which time events are blocked:

class widget {
    boost::signals::connection conn;
    void toggle_active_state() {
     if (inactive)

It is obviously awkward to be forced to convert this code to use an RAII
object, and I'd rather not do a full connect/disconnect for this state
change. What do you think? Should I be thinking about this differently?
Or can a good case be made for bringing back the block()/unblock() methods?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at