circuitpython/lib
Damien George b6b39bff47 py/gc: Make gc_lock_depth have a count per thread.
This commit makes gc_lock_depth have one counter per thread, instead of one
global counter.  This makes threads properly independent with respect to
the GC, in particular threads can now independently lock the GC for
themselves without locking it for other threads.  It also means a given
thread can run a hard IRQ without temporarily locking the GC for all other
threads and potentially making them have MemoryError exceptions at random
locations (this really only occurs on MCUs with multiple cores and no GIL,
eg on the rp2 port).

The commit also removes protection of the GC lock/unlock functions, which
is no longer needed when the counter is per thread (and this also fixes the
cas where a hard IRQ calling gc_lock() may stall waiting for the mutex).

It also puts the check for `gc_lock_depth > 0` outside the GC mutex in
gc_alloc, gc_realloc and gc_free, to potentially prevent a hard IRQ from
waiting on a mutex if it does attempt to allocate heap memory (and putting
the check outside the GC mutex is now safe now that there is a
gc_lock_depth per thread).

Signed-off-by: Damien George <damien@micropython.org>
2021-05-10 13:07:16 +10:00
..
asf4@d270f79aa1 lib: Add asf4 as a submodule. 2019-07-01 17:18:44 +10:00
axtls@43a6e6bd3b axtls: Update, exposes AES functions to implement ECB chiper mode. 2017-11-05 11:37:05 +02:00
berkeley-db-1.xx@35aaec4418 berkeley-db-1.xx: Update, allow to override MINCACHE, DEFPSIZE. 2017-09-10 13:51:51 +03:00
btstack@c8b9823f68 lib/btstack: Update to c8b9823 for USB HCI reset timeout fix. 2020-04-29 16:54:12 +10:00
cmsis/inc lib/cmsis: Upgrade to CMSIS 5.5.1. 2019-06-03 14:40:57 +10:00
embed py/stream: Remove mp_stream_errno and use system errno instead. 2020-04-27 23:58:46 +10:00
libc lib/libc: Fix string0's implementation of strncpy. 2020-07-22 16:29:54 +10:00
libffi@e9de7e35f2 lib/libffi: Add libffi as a submodule. 2015-10-17 15:52:35 +03:00
libhydrogen@5c5d513093 lib/libhydrogen: Add new libhydrogen submodule. 2021-01-18 12:43:01 +11:00
libm lib/libm: Reduce size of static two_over_pi array. 2020-09-04 00:45:56 +10:00
libm_dbl lib/libm_dbl: Add round.c source code. 2020-07-21 11:07:19 +10:00
littlefs lib/littlefs: Guard lfs2_mlist_isopen with LFS2_NO_ASSERT. 2020-12-09 13:19:31 +11:00
lwip@159e31b689 lib/lwip: Update lwIP to v2.1.2, tag STABLE-2_1_2_RELEASE. 2019-07-04 10:36:23 +10:00
mbedtls@1b6a24f759 lib/mbedtls: Switch to currently latest commit of LTS branch v2.16. 2021-03-11 11:49:18 +11:00
mbedtls_errors lib/mbedtls_errors: Add code to patch mbedtls for shortened error strs. 2020-07-20 23:53:27 +10:00
memzip lib/memzip: Make lexer constructor raise exception when file not found. 2017-03-14 11:52:05 +11:00
mp-readline lib/mp-readline: Add word-based move/delete EMACS key sequences. 2020-01-12 13:09:27 +11:00
mynewt-nimble@97ce3eacaa lib/mynewt-nimble: Update submodule to NimBLE release 1.3.0. 2020-04-27 22:50:42 +10:00
netutils all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
nrfx@7a4c9d946c lib/nrfx: Upgrade to nrfx v2.0.0. 2020-05-15 15:06:02 +10:00
nxp_driver@b618cb1d52 mimxrt: Add new, minimal port to NXP i.MX RT series CPUs. 2020-03-11 15:34:13 +11:00
oofatfs lib/oofatfs: Update oofatfs library to fix issue with logic not. 2019-03-07 15:03:09 +11:00
pico-sdk@fc10a97c38 lib/pico-sdk: Update to latest version 1.1.0. 2021-03-12 01:00:00 +11:00
stm32lib@302c52794d lib/stm32lib: Update library for WB v1.10.0. 2020-12-10 12:26:24 +11:00
timeutils lib/timeutils: Provide simple impl of extra funcs when Epoch is 1970. 2021-01-29 23:57:10 +11:00
tinytest Revert "lib/tinytest: Clean up test reporting in the presence of std..." 2019-12-19 17:53:46 +11:00
tinyusb@7b62c71dd5 lib/tinyusb: Update to version 0.8.0. 2021-02-12 12:50:22 +11:00
upytesthelper py: Add global default_emit_opt variable to make emit kind persistent. 2019-08-28 12:47:58 +10:00
utils py/gc: Make gc_lock_depth have a count per thread. 2021-05-10 13:07:16 +10:00
README.md lib: Add basic README. 2014-09-18 00:13:03 +01:00

This directory contains standard, low-level C libraries with emphasis on being independent and efficient. They can be used by any port.