What happens if we await a signal but it never gets emits?

Godot Version

4.0+

Question

What happens if we await a signal but it never gets emits? For example if we have the following code:

func foo():
	print("Waiting signal")

	await object.signalled 

	print("Finished waiting")

What happens if the object gets destroyed or the signal never emits? Will that function be suspended forever until the games closes? Does this have any major negative impact? i.e. we call foo 10000x times and now we are awaiting 10000 times indefinitely?

Yes, it’ll wait indefinitely. The waiting itself doesn’t have a performance impact, but calling the signal eventually might have.

1 Like