Skip to content

Make GetFlagsV1 async to avoid blocking the UI thread#396

Merged
Shivansps merged 1 commit into
KnossosNET:mainfrom
Goober5000:fix/ui_block
May 9, 2026
Merged

Make GetFlagsV1 async to avoid blocking the UI thread#396
Shivansps merged 1 commit into
KnossosNET:mainfrom
Goober5000:fix/ui_block

Conversation

@Goober5000
Copy link
Copy Markdown
Contributor

GetFlagsV1() was called synchronously on the UI thread at startup, when navigating to the Settings tab, and when opening the Configure Flags dialog. This caused a brief UI freeze each time FSO was spawned to read flag data.

Also fixes a potential pipe deadlock: the original code read stdout to completion before reading stderr. If FSO wrote more than ~4 KB to stderr the process would block waiting for the pipe to drain, which Knossos would never do until stdout finished -- a classic deadlock. The fix reads both streams concurrently with Task.WhenAll before calling WaitForExitAsync.

GetFlagsV1() was called synchronously on the UI thread at startup, when
navigating to the Settings tab, and when opening the Configure Flags
dialog. This caused a brief UI freeze each time FSO was spawned to read
flag data.

Also fixes a potential pipe deadlock: the original code read stdout to
completion before reading stderr. If FSO wrote more than ~4 KB to stderr
the process would block waiting for the pipe to drain, which Knossos
would never do until stdout finished -- a classic deadlock. The fix
reads both streams concurrently with Task.WhenAll before calling
WaitForExitAsync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wookieejedi
Copy link
Copy Markdown
Contributor

Testing and this one works fine

@Shivansps Shivansps merged commit 29b6f20 into KnossosNET:main May 9, 2026
@Goober5000 Goober5000 deleted the fix/ui_block branch May 9, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants