• Angus Gratton's avatar
    rp2: Fix recursive atomic sections when core1 is active. · cfa55b4c
    Angus Gratton authored
    mp_thread_begin_atomic_section() is expected to be recursive (i.e. for
    nested machine.disable_irq() calls, or if Python code calls disable_irq()
    and then the Python runtime calls mp_handle_pending() which also enters an
    atomic section to check the scheduler state).
    
    On rp2 when not using core1 the atomic sections are recursive.
    
    However when core1 was active (i.e. _thread) then there was a bug that
    caused the core to live-lock if an atomic section recursed.
    
    Adds a test case specifically for mutual exclusion and recursive atomic
    sections when using two threads. Without this fix the test immediately
    hangs on rp2.
    
    This work was funded through GitHub Sponsors.
    Signed-off-by: default avatarAngus Gratton <angus@redyak.com.au>
    cfa55b4c
disable_irq.py.exp 21 Bytes