From 3811f091f2e8d613a232500a3feb4541dfaeb0c9 Mon Sep 17 00:00:00 2001 From: Bart Van Severen Date: Fri, 20 Sep 2024 08:20:14 +0200 Subject: [PATCH] package/libwebsockets: fix LWS_MAX_SMP when BR2_TOOLCHAIN_HAS_THREADS is set The .mk file currently states: If LWS_MAX_SMP=1, then there is no code related to pthreads compiled in the library. If unset, LWS_MAX_SMP defaults to 32 and a small amount of pthread mutex code is built into the library. However, this is incorrect: when unset, LWS_MAX_SMP is actually set to 1, so mutexes aren't built in. To fix, set it to 32 explicitly when threads are enabled. Why 32? Because https://libwebsockets.org/lws-api-doc-master/html/md_README.coding.html states: You can control the context basic data allocation for multithreading from Cmake using -DLWS_MAX_SMP=, if not given it's set to 32. Signed-off-by: Bart Van Severen Signed-off-by: Thomas Devoogdt Signed-off-by: Thomas Petazzoni (cherry picked from commit b3abf16c8ef7cf7b2493b3ddfc66ec132c42493b) Signed-off-by: Thomas Perale --- package/libwebsockets/libwebsockets.mk | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package/libwebsockets/libwebsockets.mk b/package/libwebsockets/libwebsockets.mk index e53febfce4..90ab5da0c9 100644 --- a/package/libwebsockets/libwebsockets.mk +++ b/package/libwebsockets/libwebsockets.mk @@ -18,15 +18,14 @@ LIBWEBSOCKETS_CONF_OPTS = \ -DLWS_WITHOUT_EXTENSIONS=OFF # If LWS_MAX_SMP=1, then there is no code related to pthreads compiled -# in the library. If unset, LWS_MAX_SMP defaults to 32 and a small -# amount of pthread mutex code is built into the library. +# in the library. If unset, LWS_MAX_SMP defaults to 1. ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),) LIBWEBSOCKETS_CONF_OPTS += \ -DLWS_MAX_SMP=1 \ -DLWS_WITH_SYS_SMD=OFF else LIBWEBSOCKETS_CONF_OPTS += \ - -DLWS_MAX_SMP= \ + -DLWS_MAX_SMP=32 \ -DLWS_WITH_SYS_SMD=ON endif