Details on signals

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dotty

I want to know the specific mechanics of emit_signal()

Are signal handlers invoked immediately and in the threading context of the emitter (if any multi-threading is involved) or is the signal a event like message posted to message queue? (I think it does not)

Or something else?

The two distinct bits of information I am after are, when do the handlers execute and in what context, and are message queues involved or not

To my understanding, when you emit a signal, the connected functions will be executed in a similar manner to what would happen if you’d just directly call the function, in a single-threaded immediate basis.
But all my information comes from placing a breakpoint before the emit_signal() line and stepping through the code execution in the debugger, so take it with the appropriately sized grain of salt.

NiceMicro | 2021-04-09 23:29

This level of knowledge, you might be best served by just looking at Godot’s source code. Open source ftw

beaverusiv | 2021-04-11 03:30

Yeh I could but I’d like to capture it outside of an individual groveling through the source. How signals are handled comes under design considerations, such the cpu cost of processing signals at certain points in godot’s processing cycle.

dotty | 2021-04-11 14:35

Thank you , I expect this is the case.

dotty | 2021-04-11 14:37