From 42dfa71f978296edd79040641234d9496f1439a7 Mon Sep 17 00:00:00 2001 From: sg Date: Thu, 30 Jun 2016 22:37:37 +0200 Subject: [PATCH] Make LWIP_TCPIP_CORE_LOCKING==1 the default (and warn if LWIP_COMPAT_MUTEX==1 in that case as mutexes are required to prevent priority inversion on tcpip_thread operations) --- src/core/init.c | 3 +++ src/include/lwip/opt.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/init.c b/src/core/init.c index 5975ce4a..b78384f9 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -252,6 +252,9 @@ #ifdef ETHARP_ALWAYS_INSERT #error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h." #endif +#if LWIP_TCPIP_CORE_LOCKING && LWIP_COMPAT_MUTEX && !defined(LWIP_COMPAT_MUTEX_ALLOWED) + #error "LWIP_COMPAT_MUTEX cannot prevent priority inversion. It is recommended to implement priority-aware mutexes. (Define LWIP_COMPAT_MUTEX_ALLOWED to disable this error.)" +#endif #ifndef LWIP_DISABLE_TCP_SANITY_CHECKS #define LWIP_DISABLE_TCP_SANITY_CHECKS 0 diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 6b43f06b..9ff31a4c 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1447,7 +1447,7 @@ * Your system should provide mutexes supporting priority inversion to use this. */ #ifndef LWIP_TCPIP_CORE_LOCKING -#define LWIP_TCPIP_CORE_LOCKING 0 +#define LWIP_TCPIP_CORE_LOCKING 1 #endif /**