Easier deferred emitting of a signal?

Godot Version

v4.3.stable.official [77dcf97d8]

Question

I hope I’m just overlooking something obvious, but is there an easier way to delay the emission of a signal to the very end of a frame – like a deferred funcion call – than this?

(func():my_signal.emit()).call_deferred()

It needs to work with await, and the context for this use case is that I have implemented my own parallel async coordinator (think Promise.all of JavaScript or Task.WhenAll of C#), and sometimes all the async jobs finish immediately, and I’m using my solution like so:

await Promise.all(signal_arr).settled

For scientific purposes, this is the current source for the mentioned code:

Actually exists, just set the deferred call flag in the connect function:

your_signal.connect(the_callable, ConnectFlags.CONNECT_DEFERRED)

1 Like

my_signal.emit.call_deferred(), but @matheusmdx 's answer is usually the better approach.

How would that work with await?

Of course! :slight_smile: Thank you!