summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-03-12 16:46:20 +1100
committerDamien George <damien.p.george@gmail.com>2020-03-26 01:25:45 +1100
commitbc009fdd62f913e36443f8267ffb6133f537fff3 (patch)
tree977959e2e1f54abaf233924188e8fcc5e61c8ab8 /py
parent081d06766223b326b6d7eeceae817b7a3a3f57b0 (diff)
extmod/uasyncio: Add optional implementation of core uasyncio in C.
Implements Task and TaskQueue classes in C, using a pairing-heap data structure. Using this reduces RAM use of each Task, and improves overall performance of the uasyncio scheduler.
Diffstat (limited to 'py')
-rw-r--r--py/builtin.h1
-rw-r--r--py/mpconfig.h4
-rw-r--r--py/objmodule.c3
-rw-r--r--py/py.mk1
4 files changed, 9 insertions, 0 deletions
diff --git a/py/builtin.h b/py/builtin.h
index 2dbe8a782..1e4769cd6 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -103,6 +103,7 @@ extern const mp_obj_module_t mp_module_thread;
extern const mp_obj_dict_t mp_module_builtins_globals;
// extmod modules
+extern const mp_obj_module_t mp_module_uasyncio;
extern const mp_obj_module_t mp_module_uerrno;
extern const mp_obj_module_t mp_module_uctypes;
extern const mp_obj_module_t mp_module_uzlib;
diff --git a/py/mpconfig.h b/py/mpconfig.h
index c5829a3e0..d96687b81 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -1291,6 +1291,10 @@ typedef double mp_float_t;
// Extended modules
+#ifndef MICROPY_PY_UASYNCIO
+#define MICROPY_PY_UASYNCIO (0)
+#endif
+
#ifndef MICROPY_PY_UCTYPES
#define MICROPY_PY_UCTYPES (0)
#endif
diff --git a/py/objmodule.c b/py/objmodule.c
index 79047009f..060e1bc1e 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -170,6 +170,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
// extmod modules
+ #if MICROPY_PY_UASYNCIO
+ { MP_ROM_QSTR(MP_QSTR__uasyncio), MP_ROM_PTR(&mp_module_uasyncio) },
+ #endif
#if MICROPY_PY_UERRNO
{ MP_ROM_QSTR(MP_QSTR_uerrno), MP_ROM_PTR(&mp_module_uerrno) },
#endif
diff --git a/py/py.mk b/py/py.mk
index 1a56dcce8..8c90beff7 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -168,6 +168,7 @@ PY_CORE_O_BASENAME = $(addprefix py/,\
)
PY_EXTMOD_O_BASENAME = \
+ extmod/moduasyncio.o \
extmod/moductypes.o \
extmod/modujson.o \
extmod/modure.o \