Skip to content

Fix: add mutex to GlobalHistogramBinarizer for concurrent access safety#83

Open
bashhack wants to merge 1 commit intomakiuchi-d:masterfrom
bashhack:fix/histogram-binarizer-mutex
Open

Fix: add mutex to GlobalHistogramBinarizer for concurrent access safety#83
bashhack wants to merge 1 commit intomakiuchi-d:masterfrom
bashhack:fix/histogram-binarizer-mutex

Conversation

@bashhack
Copy link
Copy Markdown
Contributor

Summary

  • Add sync.Mutex to GlobalHistogramBinarizer to protect GetBlackRow() and GetBlackMatrix() from concurrent access
  • Both methods mutate shared luminances and buckets fields via initArrays() with no synchronization, chains data races under concurrent use

Context

This complements PR #75 (sync.Once on GetBlackMatrix) and PR #81 (BitMatrix.Clone in parser). Together they address the three concurrent access points in the decode pipeline.

Testing

  • All existing test packages pass, apart from an upstream, unrelated failure in TestDefaultGridSampler_SampleGrid of course

@bashhack bashhack changed the title fix: add mutex to GlobalHistogramBinarizer for concurrent access safety Fix: add mutex to GlobalHistogramBinarizer for concurrent access safety Mar 29, 2026
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.

1 participant