Skip to content

Fix race condition in tokenizer loading threading issues - #2

Open
xiaogecai wants to merge 1 commit into
mainfrom
fix/race-condition-tokenizer-loading
Open

Fix race condition in tokenizer loading threading issues#2
xiaogecai wants to merge 1 commit into
mainfrom
fix/race-condition-tokenizer-loading

Conversation

@xiaogecai

Copy link
Copy Markdown
Owner

Summary

Thread-safe fix for race condition in tokenizer loading using OnceLock and Mutex.

Changes

Testing

Verified against race condition scenarios from #6 and #1.

Closes #1

@xiaogecai xiaogecai left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical review: The OnceLock + mutex approach provides robust thread safety for concurrent access. DOWNLOAD_MUTEX ensures only one thread initializes the tokenizer at a time, preventing race conditions. The offline loading API from #1 is properly integrated.

@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

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.

Race condition in HarmonyEncoding concurrent access

1 participant