From 676f7aa80821aa681030a5c43ce7e6c03b65241b Mon Sep 17 00:00:00 2001 From: jepler Date: Mon, 9 Sep 2019 20:04:08 -0500 Subject: 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('')` --- shared-module/os/__init__.c | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-module') diff --git a/shared-module/os/__init__.c b/shared-module/os/__init__.c index 313893d97..8060eec4f 100644 --- a/shared-module/os/__init__.c +++ b/shared-module/os/__init__.c @@ -128,6 +128,7 @@ mp_obj_t common_hal_os_listdir(const char* path) { while ((next = mp_iternext(iter_obj)) != MP_OBJ_STOP_ITERATION) { // next[0] is the filename. mp_obj_list_append(dir_list, mp_obj_subscr(next, MP_OBJ_NEW_SMALL_INT(0), MP_OBJ_SENTINEL)); + RUN_BACKGROUND_TASKS; } return dir_list; } -- cgit v1.2.3