fix: Acquire lock when printing text to fix race condition#198
Merged
schollz merged 1 commit intoschollz:mainfrom Sep 15, 2024
Merged
fix: Acquire lock when printing text to fix race condition#198schollz merged 1 commit intoschollz:mainfrom
schollz merged 1 commit intoschollz:mainfrom
Conversation
Owner
|
Thanks! |
renovate bot
referenced
this pull request
in nobl9/sloctl
Sep 15, 2024
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/schollz/progressbar/v3](https://redirect.github.com/schollz/progressbar) | `v3.14.6` -> `v3.15.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>schollz/progressbar (github.com/schollz/progressbar/v3)</summary> ### [`v3.15.0`](https://redirect.github.com/schollz/progressbar/releases/tag/v3.15.0) [Compare Source](https://redirect.github.com/schollz/progressbar/compare/v3.14.6...v3.15.0) #### What's Changed - new: feature scrolling detail by [@​luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) in [https://github.com/schollz/progressbar/pull/194](https://redirect.github.com/schollz/progressbar/pull/194) - fix: Acquire lock when printing text to fix race condition by [@​gabe565](https://redirect.github.com/gabe565) in [https://github.com/schollz/progressbar/pull/198](https://redirect.github.com/schollz/progressbar/pull/198) - fix: change some attribute about time to time.Time{} by [@​luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) in [https://github.com/schollz/progressbar/pull/196](https://redirect.github.com/schollz/progressbar/pull/196) - fix:fixed the bug that changMax isn't working. by [@​luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) in [https://github.com/schollz/progressbar/pull/193](https://redirect.github.com/schollz/progressbar/pull/193) #### New Contributors - [@​luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) made their first contribution in [https://github.com/schollz/progressbar/pull/194](https://redirect.github.com/schollz/progressbar/pull/194) **Full Changelog**: schollz/progressbar@v3.14.6...v3.15.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/nobl9/sloctl). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwiZ29sYW5nIiwicmVub3ZhdGUiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.
Hey!
I've been testing the new
BprintfandBprintlnfunctions, and have found a race condition.If text is printed at the same time as
Writeis called, there's a chance that some of the text will not be printed. This is becausebytes.Bufferis not thread-safe. In my testing, acquiring a lock inBprintfandBprintlnfixes the issue.