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


Hi,

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 {
private:
    boost::signals::connection conn;
    ...
public:
    void toggle_active_state() {
     ...
     if (inactive)
        conn.block();
     else
        conn.unblock();
    }
};

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?

Thanks,
-bryan


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