Skip to content

Commit 4e79698

Browse files
peterharperukdpgeorge
authored andcommitted
rp2/pendsv: Fix PendSV_Handler dispatch check when threading enabled.
If MICROPY_PY_THREAD is set, PendSV_Handler acquires a mutex and calls the dispatch functions. If pendsv_schedule_dispatch is called by a higher priority interrupt while the mutex is acquired by PendSV_Handler it's possible for the dispatch to not be triggered. Add a check for dispatch calls at the end of PendSV_Handler once the mutex has been released. Fixes issue micropython#18365. Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
1 parent 0944376 commit 4e79698

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

ports/rp2/pendsv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,7 @@ void PendSV_Handler(void) {
180180

181181
#if MICROPY_PY_THREAD
182182
mp_thread_recursive_mutex_unlock(&pendsv_mutex);
183+
// Check if a dispatch occurred while the interrupt was being serviced
184+
pendsv_resume_run_dispatch();
183185
#endif
184186
}

0 commit comments

Comments
 (0)