winrt-notification
winrt-notification copied to clipboard
Purpose of sleep
What is the purpose of https://github.com/allenbenz/winrt-notification/blob/f7879fd06615cb62692469966edf28326639d7dc/src/lib.rs#L335?
Is the toast notification function not blocking?
There's a race where if the application closes before some part of the internal toast process (non-application layer) completes the toast won't get shown. The window is small and the 10ms wait satisfies the race condition.
So in a long running program this isn't required. Though Toasts are rate limited so the wait shouldn't be too big of an issue for most applications.
You can reproduce the issue by running the tests/examples with the sleep removed, the toast will sometimes not appear (or never appear)
Shouldn't it return a Future<Result>
then? The caller can choose whether they want to block on the thread.
Probably useful to add an inline note about that for anyone else curious about that line :sweat_smile: