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 <bart.vanseveren@barco.com>
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit b3abf16c8e)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Bart Van Severen
2024-09-20 08:20:14 +02:00
committed by Thomas Perale
parent eea5fba3d4
commit 3811f091f2

View File

@@ -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