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

Per-thread exceptions #7251

Closed
wants to merge 2 commits into from
Closed

Commits on May 11, 2021

  1. py/mpstate: Make exceptions thread-local.

    This moves mp_pending_exception from mp_state_vm_t to mp_state_thread_t.
    This allows exceptions to be scheduled on a specific thread.
    
    Signed-off-by: David Lechner <david@pybricks.com>
    dlech committed May 11, 2021
    Configuration menu
    Copy the full SHA
    529afbe View commit details
    Browse the repository at this point in the history
  2. py/mpstate: Schedule KeyboardInterrupt on main thread.

    This introduces a new macro to get the main thread and uses it to ensure
    that asynchronous exceptions such as KeyboardInterrupt (CTRL+C) are only
    scheduled on the main thread. This is more deterministic than being
    scheduled on a random thread and is more in line with CPython that only
    allow signal handlers to run on the main thread.
    
    Issue: micropython#7026
    Signed-off-by: David Lechner <david@pybricks.com>
    dlech committed May 11, 2021
    Configuration menu
    Copy the full SHA
    7ff789f View commit details
    Browse the repository at this point in the history