Struct SignalFuture
pub struct SignalFuture<R>(/* private fields */)
where
R: InParamTuple + IntoDynamicSend;Expand description
The panicking counter part to the FallibleSignalFuture.
This future works in the same way as FallibleSignalFuture, but panics when the signal object is freed, instead of resolving to a
Result::Err.
§Panics
- If the signal object is freed before the signal has been emitted.
- If one of the signal arguments is
!Send, but the signal was emitted on a different thread.
During engine shutdown, this does not panic: when the signal object is freed before emission as part of the main loop being torn down, the awaiting task stays suspended and is dropped silently instead. This keeps “fire-and-forget” tasks from spamming errors on application exit.
§Keeping the signal object alive
If the signal object is freed concurrently while the future is being dropped, connection cleanup is skipped and the stale connection is
leaked (Godot removes it once the object dies), rather than aborting the process. This is only reachable by moving a Gd across threads,
which requires unsafe (Gd is !Send); in safe, single-threaded code it cannot happen. If you do bypass !Send, it is your
responsibility to keep the object alive – retain a strong Gd on the runtime thread, or join() the other thread – until no pending
future refers to it.