Repository navigation
Add AsyncConnector and non-blocking background connection - #978
Merged
Merged
Conversation
PCMan
force-pushed
the
feature-async-connection
branch
from
October 21, 2026 07:10
2829710 to
0fee870
Compare
Implement asynchronous pipe connection and init RPC execution using the Windows Threadpool API to eliminate host UI freezes during IME activation. Marshal completion callbacks safely back to the host UI thread via a hidden message-only window and WM_PIME_ASYNC_DONE. Increment DLL reference count during threadpool task execution so FreeLibraryWhenCallbackReturns safely balances the module reference count without premature DLL unloading. Use non-throwing JSON parsing and cancellable retry intervals between connection attempts. Generated with assistance from Google Antigravity (Gemini 3.8 Flash)
…ction Replace synchronous named pipe connection and blocking init handshake with AsyncConnector and RpcPipe. Introduce Client::State enum (Disconnected, Connecting, Ready) to cleanly track connection lifecycle and eliminate ambiguous state combinations. Implement Client::ensureConnected() to automatically trigger asynchronous reconnection on user interaction if connection was lost or started while PIMELauncher was down. Replace throwing json::parse and try/catch blocks with parseJsonNoThrow and jsonValueOr for SEH safety in arbitrary host applications. Generated with assistance from Google Antigravity (Gemini 3.8 Flash)
PCMan
force-pushed
the
feature-async-connection
branch
from
October 21, 2026 07:15
0fee870 to
6f9d5b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR builds on top of #979 (
refactor/rpc-pipe) to move pipe connection and initialization off the host UI thread:AsyncConnectorbackground threadpool: Performs pipe connection and theinitRPC handshake asynchronously using the Windows Threadpool API to eliminate UI freezes during IME activation. Completion is safely marshaled to the host UI thread via a hidden message-only window andWM_PIME_ASYNC_DONE.FreeLibraryWhenCallbackReturnsto eliminate fast-fail crashes (0xc0000409) on module unload in arbitrary host processes.Client::Statelifecycle: Introduces an explicitClient::Stateenum (Disconnected,Connecting,Ready) to manage connection states cleanly without ambiguous flag combinations.ensureConnected()to automatically trigger asynchronous reconnection upon user input if the backend was restarting or down during IME activation.Generated with assistance from Google Antigravity (Gemini 3.8 Flash).