Is the order of signal hander execution defined?

If a widget connects a signal to multiple handlers as shown below the handlers are appear to be always executed in the order they are connected. Is this order defined?

widget.connect('notification', handler1)
widget.connect('notification', handler2)
widget.emit('notification')

This order can be specified using the C API, but nothing I’ve found so far suggests that it can be in Python API.

The order cannot be specified, even with the C API.

In practice, the order of invocation is the order of connection, otherwise a whole lot of API would be impossible to implement.

The order cannot be specified, even with the C API.

In that case I must have misread,

  • signal_flags: partly defines the order in which closures which were connected to the signal are invoked

In any case I am content that the order of invocation is defined, as the order of connection.

The signal flags decide whether to call the signal’s default closure before or after the callbacks registered using g_signal_connect(). It has no bearing on the order of the connected callbacks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.