Skip to content

Commit 676f7aa

Browse files
committed
os_listdir: This can be long-running, run background tasks
While finding sources of clicks and buzzes in nrf i2sout, I identified this site as one which could be long running. Reproducer code was to play a 22.05kHz sample and repeatedly print `os.listdir('')`
1 parent d9c8460 commit 676f7aa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

shared-module/os/__init__.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ mp_obj_t common_hal_os_listdir(const char* path) {
128128
while ((next = mp_iternext(iter_obj)) != MP_OBJ_STOP_ITERATION) {
129129
// next[0] is the filename.
130130
mp_obj_list_append(dir_list, mp_obj_subscr(next, MP_OBJ_NEW_SMALL_INT(0), MP_OBJ_SENTINEL));
131+
RUN_BACKGROUND_TASKS;
131132
}
132133
return dir_list;
133134
}

0 commit comments

Comments
 (0)