Home | Libraries | People | FAQ | More |
boost::signals2::shared_connection_block — Blocks a connection between a signal and a slot.
// In header: <boost/signals2/shared_connection_block.hpp> class shared_connection_block { public: // construct/copy/destruct shared_connection_block(const boost::signals2::connection & = connection(), bool = true); shared_connection_block(const boost::signals2::shared_connection_block &); shared_connection_block& operator=(const boost::signals2::shared_connection_block &); ~shared_connection_block(); // connection blocking void unblock(); void block(); bool blocking() const; // miscellaneous methods boost::signals2::connection connection() const; };
A shared_connection_block
object blocks a
connection, preventing the associated slot from executing when the
associated signal is invoked. The connection will remain
blocked until every shared_connection_block
that references
the connection
releases its block. A shared_connection_block
releases
its block when it is destroyed or its
unblock method is called.
A shared_connection_block
is safe to use even
after the signals2::connection object it was constructed
from has been destroyed, or the connection it references has been
disconnected.
Note, blocking a connection does not guarantee the associated slot has finished execution if it is already in the process of being run when the connection block goes into effect. This is similar to the behaviour of disconnect, in that blocking a connection will not wait for the connection's associated slot to complete execution. This situation may arise in a multi-threaded environment if the connection block goes into effect concurrently with signal invocation, or in a single-threaded environment if a slot blocks its own connection.
shared_connection_block
public
construct/copy/destructshared_connection_block(const boost::signals2::connection & conn = connection(), bool initially_blocking = true);
Effects: |
Creates a Default construction of a |
Postconditions: |
|
shared_connection_block(const boost::signals2::shared_connection_block & other);
Effects: |
Copy constructs a |
Postconditions: |
|
shared_connection_block& operator=(const boost::signals2::shared_connection_block & rhs);
Effects: |
Makes |
Postconditions: |
|
Throws: |
Will not throw. |
~shared_connection_block();
Effects: |
If blocking() is true, releases the connection block. |
shared_connection_block
connection blockingvoid unblock();
Effects: |
If blocking() is true, releases the connection block.
Note, the connection may remain blocked due to
other |
Postconditions: |
|
void block();
Effects: |
If blocking() is false, reasserts a block on the connection. |
Postconditions: |
|
bool blocking() const;
Returns: |
|
Notes: |
|
shared_connection_block
miscellaneous methodsboost::signals2::connection connection() const;
Returns: |
A connection object for the connection referenced by |