mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
py/modmicropython: Add heap_locked function to test state of heap.
This commit adds micropython.heap_locked() which returns the current lock-depth of the heap, and can be used by Python code to check if the heap is locked or not. This new function is configured via MICROPY_PY_MICROPYTHON_HEAP_LOCKED and is disabled by default. This commit also changes the return value of micropython.heap_unlock() so it returns the current lock-depth as well.
This commit is contained in:
committed by
Damien George
parent
7eea0d8b6c
commit
86bfabec11
@@ -1069,6 +1069,11 @@ typedef double mp_float_t;
|
||||
#define MICROPY_PY_MICROPYTHON_STACK_USE (MICROPY_PY_MICROPYTHON_MEM_INFO)
|
||||
#endif
|
||||
|
||||
// Whether to provide the "micropython.heap_locked" function
|
||||
#ifndef MICROPY_PY_MICROPYTHON_HEAP_LOCKED
|
||||
#define MICROPY_PY_MICROPYTHON_HEAP_LOCKED (0)
|
||||
#endif
|
||||
|
||||
// Whether to provide "array" module. Note that large chunk of the
|
||||
// underlying code is shared with "bytearray" builtin type, so to
|
||||
// get real savings, it should be disabled too.
|
||||
|
||||
Reference in New Issue
Block a user