This repository was archived by the owner on May 11, 2025. It is now read-only.
Wait for available data in nextLine function#1305
Open
ethanaobrien wants to merge 1 commit intoWhisky-App:mainfrom
Open
Wait for available data in nextLine function#1305ethanaobrien wants to merge 1 commit intoWhisky-App:mainfrom
ethanaobrien wants to merge 1 commit intoWhisky-App:mainfrom
Conversation
| extension FileHandle { | ||
| func nextLine() -> String? { | ||
| while availableData.isEmpty { | ||
| Thread.sleep(forTimeInterval: 0.2) |
Member
There was a problem hiding this comment.
I don't think this is really a solution. This is still going to block the entire thread responsible for handling logs and can arguably lead to more downtime then spin-waiting
Author
There was a problem hiding this comment.
Do you have an alternative approach that can be taken? At the moment this issue causes a 100% utilized thread per opened application, so when I open 3 apps from the whisky menu I have a 300% CPU usage by whisky and get a ridiculous power draw for nothing.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 should fix #1010 which is a critical(ly annoying) enough bug that I downloaded Xcode to figure this out.
I have no idea if this has any unintended issues, because I do not know the codebase or swift. Feel free to close this PR if it has unintended issues