lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Require sys_arch_protect/unprotect to be correctly nested?


From: Douglas
Subject: [lwip-devel] Require sys_arch_protect/unprotect to be correctly nested?
Date: Wed, 19 Jul 2017 23:15:42 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Most uses of sys_arch_protect/unprotect appear to be nested correctly,
so that it is unnecessary to note the current nesting level. It is not
uncommon for a recursive mutex implementation to not expose the level
and to require matching acquire and release operations. The FreeRTOS
vPortEnterCritical function does not return a nesting level.

So would a change to require sys_arch_protect/unprotect to have matching
nesting be considered, perhaps even cleaning these up by removing the
*DECL_PROTECT macros and the levels?

A quick inspection suggests one non-nested use in alloc_socket, but that
looks like a programming error and a patch will be submitted.


There is a use of these in socket.c:event_callback that looks
problematic. There is a code comment:

"Don't call SYS_ARCH_UNPROTECT() before signaling the semaphore, as this
might lead to the select thread taking itself off the list, invalidating
the semaphore."

If sys_arch_protect were implemented via a mutex then could the above
really offer the required protection?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]