Skip to content

Commit

Permalink
macOS: Fix some kittens causing 100% CPU usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 19, 2019
1 parent 6b6dea5 commit 9fdd8e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Changelog
- macOS: Add aliases for close window and new tab actions that conform to common
Apple shortcuts for these actions (:iss:`1313`)

- macOS: Fix some kittens causing 100% CPU usage


0.13.2 [2019-01-04]
------------------------------
Expand Down
5 changes: 3 additions & 2 deletions kittens/tui/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ class Loop:
def __init__(self,
sanitize_bracketed_paste='[\x03\x04\x0e\x0f\r\x07\x7f\x8d\x8e\x8f\x90\x9b\x9d\x9e\x9f]'):
if is_macos:
# On macOS PTY devices are not supported by the KqueueSelector
self.asycio_loop = asyncio.SelectorEventLoop(selectors.PollSelector())
# On macOS PTY devices are not supported by the KqueueSelector and
# the PollSelector is broken, causes 100% CPU usage
self.asycio_loop = asyncio.SelectorEventLoop(selectors.SelectSelector())
asyncio.set_event_loop(self.asycio_loop)
else:
self.asycio_loop = asyncio.get_event_loop()
Expand Down

0 comments on commit 9fdd8e4

Please sign in to comment.