cryptomator / cli

Cryptomator Command-Line Interface
GNU Affero General Public License v3.0
278 stars 40 forks source link

Fix CPU hogging when running in background. #36

Closed ndob closed 3 years ago

ndob commented 3 years ago

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

overheadhunter commented 3 years ago

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