You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I’m wiring a global graceful shutdown for a Dioxus Desktop (0.6.x) app:
intercept window CloseRequested
also handle Ctrl+C / SIGTERM
show “shutting down…” in UI
run async cleanup
then exit the process
I use a Shutdown context with a CancellationToken and a Signal<bool> to flip the UI. However, the app panics on launch as soon as I keep use_context_provider(...) for this context (if I remove the provider, the app starts).
Environment: Dioxus 0.6.x, dioxus-desktop 0.6.x, tokio 1.40, macOS (Apple Silicon).
Minimal code (two files):
Cargo.toml
[dependencies]
dioxus = { version = "0.6", features = ["desktop"] }
dioxus-desktop = "0.6"tokio = { version = "1.40", features = ["rt-multi-thread", "macros", "signal"] }
tokio-util = { version = "0.7", features = ["rt"] }
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I’m wiring a global graceful shutdown for a Dioxus Desktop (0.6.x) app:
CloseRequested
I use a
Shutdown
context with aCancellationToken
and aSignal<bool>
to flip the UI. However, the app panics on launch as soon as I keepuse_context_provider(...)
for this context (if I remove the provider, the app starts).Environment: Dioxus 0.6.x, dioxus-desktop 0.6.x, tokio 1.40, macOS (Apple Silicon).
Minimal code (two files):
Cargo.toml
src/shutdown.rs
src/main.rs
What happens
Questions
use_context_provider
exactly as above in the rootApp()
?Signal<bool>
in contexts or aboutspawn
being cancelled on unmount (usespawn_forever
for cleanup?)Thanks a lot for any pointers or a minimal sample!
Beta Was this translation helpful? Give feedback.
All reactions