Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild --watch event loop to simplify; fix concurrency issues #40

Merged
merged 3 commits into from
Aug 25, 2024

Commits on Aug 25, 2024

  1. Rebuild --watch event loop to simplify, fix concurrency issues

    Before, the watcher event loop relied on multiple threads and raised an
    exception to interrupt the main thread whenever a file system change
    event happened. This was messy and resulted in zombie processes and
    other weird behavior when a file system change was detected in the
    middle of running tests.
    
    This commit refactors the implementation to use a new `EventQueue`
    class. It leverages the buffering inherent in stdin, plus uses a
    thread-safe queue for placing file system change events, and then "pops"
    the next of these in each iteration of the event loop.
    
    To avoid starting a separate thread for reading key presses, the "pop"
    operation takes turns polling stdin (peeking at its buffer to see if a
    key press happened) and blocking for short period waiting for file
    system events.
    
    The result is cleaner, easier to test, and not prone to the zombie
    process bug.
    mattbrictson committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    3f76c64 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    616b136 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    15ed958 View commit details
    Browse the repository at this point in the history