Manages and evaluates deferred Signal connections.
More...
#include <connection_evaluator.h>
Manages and evaluates deferred Signal connections.
- Warning
- Deferred connections are experimental and may be removed or changed in the future.
The ConnectionEvaluator class is responsible for managing and evaluating connections to Signals. It provides mechanisms to delay and control the evaluation of connections. It therefore allows controlling when and on which thread slots connected to a Signal are executed.
- See also
- Signal::connectDeferred()
Definition at line 32 of file connection_evaluator.h.
◆ ConnectionEvaluator() [1/3]
KDBindings::ConnectionEvaluator::ConnectionEvaluator |
( |
| ) |
|
|
default |
ConnectionEvaluators are default constructible
◆ ConnectionEvaluator() [2/3]
Connectionevaluators are not copyable
◆ ConnectionEvaluator() [3/3]
ConnectionEvaluators are not moveable
◆ ~ConnectionEvaluator()
virtual KDBindings::ConnectionEvaluator::~ConnectionEvaluator |
( |
| ) |
|
|
virtualdefault |
◆ evaluateDeferredConnections()
void KDBindings::ConnectionEvaluator::evaluateDeferredConnections |
( |
| ) |
|
|
inline |
Evaluate the deferred connections.
This function is responsible for evaluating and executing deferred connections. This function is thread safe.
- Warning
- Evaluating slots that throw an exception is currently undefined behavior.
Definition at line 64 of file connection_evaluator.h.
◆ onInvocationAdded()
virtual void KDBindings::ConnectionEvaluator::onInvocationAdded |
( |
| ) |
|
|
inlineprotectedvirtual |
Called when a new slot invocation is added.
This function can be overwritten by subclasses to get notified whenever a new invocation is added to this evaluator. The default implementation does nothing and does not have to be called by subclasses when overriding.
⚠️ Note that this function will be executed on the thread that enqueued the slot invocation (i.e. the thread that called .emit() on the signal), which is usually not the thread that is responsible for evaluating the connections! Therefore it is usually not correct to call evaluateDeferredConnections() within this function! User code is responsible for ensuring that the threads are synchronized correctly.
For example, if you plan to evaluate (execute) the slot invocations in some "main" thread A and a signal is emitted in thread B, than this method will be called on thread B. It is a good place to "wake up" the event loop of thread A so that thread A can call evaluateDeferredConnections()
.
Definition at line 108 of file connection_evaluator.h.
◆ operator=() [1/2]
◆ operator=() [2/2]
The documentation for this class was generated from the following file: