Skip to content

Fix CPU hogging when running in background.#36

Merged
overheadhunter merged 1 commit into
cryptomator:developfrom
ndob:fix_cpu_usage
Nov 9, 2020
Merged

Fix CPU hogging when running in background.#36
overheadhunter merged 1 commit into
cryptomator:developfrom
ndob:fix_cpu_usage

Conversation

@ndob
Copy link
Copy Markdown
Contributor

@ndob ndob commented Nov 3, 2020

Using "System.in.read()" to block the main thread only works if the
application is running in the foreground (user provides stdin). If
running in background or if stdin is otherwise not blocking this causes
100% cpu usage.

Fix by blocking the main thread infinitely with a condition variable.
This retains the old functionality (CTRL-C still works to quit the
application).

Fixes #35

Using "System.in.read()" to block the main thread only works if the
application is running in the foreground (user provides stdin). If
running in background or if stdin is otherwise not blocking this causes
100% cpu usage.

Fix by blocking the main thread infinitely with a condition variable.
This retains the old functionality (CTRL-C still works to quit the
application).
@overheadhunter overheadhunter merged commit 6726666 into cryptomator:develop Nov 9, 2020
@overheadhunter
Copy link
Copy Markdown
Member

While not the most elegant solution, certainly a pragmatic approach. 😄

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.

Using FUSE causes one CPU core to be always at 100% usage

2 participants