Skip to content

fix: run flash operations on background thread to avoid UI message pump dependency#501

Open
akash1306 wants to merge 2 commits intoqmk:masterfrom
akash1306:master
Open

fix: run flash operations on background thread to avoid UI message pump dependency#501
akash1306 wants to merge 2 commits intoqmk:masterfrom
akash1306:master

Conversation

@akash1306
Copy link
Copy Markdown

Flash/reset/EEPROM operations used async/await without ConfigureAwait(false), causing continuations between sequential process calls to be posted back to the UI thread via WindowsFormsSynchronizationContext. When the window received no input events, the message loop would not wake to process these continuations, stalling firmware updates for hours until a stray WM_MOUSEMOVE arrived.

Wrap bootloader operation loops in Task.Run() so continuations execute on threadpool threads with no dependency on the Windows message pump.

…mp dependency

Flash/reset/EEPROM operations used async/await without ConfigureAwait(false),
causing continuations between sequential process calls to be posted back to the
UI thread via WindowsFormsSynchronizationContext. When the window received no
input events, the message loop would not wake to process these continuations,
stalling firmware updates for hours until a stray WM_MOUSEMOVE arrived.

Wrap bootloader operation loops in Task.Run() so continuations execute on
threadpool threads with no dependency on the Windows message pump.
@akash1306
Copy link
Copy Markdown
Author

For context, I found the issue when my firmware update took hours, and turns out the toolbox was waiting for windows events. So the update moved, for example, when I moved my mouse.

tzarc
tzarc previously approved these changes Apr 1, 2026
@tzarc tzarc requested a review from a team April 1, 2026 21:39
@tzarc tzarc added the bug label Apr 1, 2026
@tzarc tzarc dismissed their stale review April 1, 2026 21:43

Build failures.

@akash1306
Copy link
Copy Markdown
Author

I'll check the error tomorrow

@akash1306
Copy link
Copy Markdown
Author

Corrected the error. It was a missing import. My bad. It's building on my machine now.

@tzarc tzarc requested a review from a team April 2, 2026 02:47
@akash1306
Copy link
Copy Markdown
Author

I was testing it this morning and the bug is still there. I needed to move my mouse to make the update move. I have to go to the office now so I'll check it in the evening. I'll confirm when I have tested it again. Sorry for the troubles.

@tzarc
Copy link
Copy Markdown
Member

tzarc commented Apr 2, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants