summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorjepler <jepler@gmail.com>2019-09-09 20:04:08 -0500
committerjepler <jepler@gmail.com>2019-09-09 20:14:02 -0500
commit676f7aa80821aa681030a5c43ce7e6c03b65241b (patch)
tree9d1296d0b97842c32254f091aca1df6604ea0a49 /shared-module
parentd9c84609344967bde3c9fa217f75fb1e7cff6fe0 (diff)
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('')`
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/os/__init__.c1
1 files changed, 1 insertions, 0 deletions
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;
}