>SYS_ARCH_LOCK_RESOURCE
It's a idea which can be merged with "task #7212 : Add Mutex concept in
sys_arch"
Yes and No, a mutex should block until it's free again. We do not have an OS, and so no primitive to block on something. You may think "OK, no OS, no thread, no need to block", but it's the very problem we have. How to lock access to a resource without the need to disable Interrupts and without OS primitives to wait until resource is free.
The proposed architecture could solve the problem although limited to mem.c module. You don't execute some parts of code because they are locked (in our example, we are currently at ISR level trying to free memory allocated by a PBUF, ISR interrupted the program while allocating some memory. All was protected by semaphores, but implemented as nothing because NO_SYS=1) but remember they weren't executed. Then, when possible execute them.
Fred.