From a18f724aa3bf57aeed285b5f61eca4a0ba891c21 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 20 Mar 2021 16:46:22 +0100 Subject: Add a thread pool implementation to libutil The thread pool enforces ordering of items during dequeue similar to the already existing implementation in libsqfs. The idea is to eventually pull this functionality out of the block processor and turn it into a cleaner, separately tested module. The thread pool is implemented as an abstract interface, so we can have multiple implementations around, including the serial fallback implementation which we can then *always* test, irregardless of the compile config and run through static analysis as well. Signed-off-by: David Oberhollenzer --- lib/util/Makemodule.am | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/util/Makemodule.am') diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am index 39352f4..113855c 100644 --- a/lib/util/Makemodule.am +++ b/lib/util/Makemodule.am @@ -4,9 +4,27 @@ libutil_a_SOURCES += lib/util/rbtree.c include/rbtree.h libutil_a_SOURCES += lib/util/array.c include/array.h libutil_a_SOURCES += lib/util/xxhash.c lib/util/hash_table.c libutil_a_SOURCES += lib/util/fast_urem_by_const.h +libutil_a_SOURCES += include/threadpool.h +libutil_a_SOURCES += include/w32threadwrap.h +libutil_a_SOURCES += lib/util/threadpool_serial.c libutil_a_CFLAGS = $(AM_CFLAGS) libutil_a_CPPFLAGS = $(AM_CPPFLAGS) +if WINDOWS +libutil_a_CFLAGS += -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 +endif + +if HAVE_PTHREAD +libutil_a_SOURCES += lib/util/threadpool.c +libutil_a_CFLAGS += $(PTHREAD_CFLAGS) +else +if WINDOWS +libutil_a_SOURCES += lib/util/threadpool.c +else +libutil_a_CPPFLAGS += -DNO_THREAD_IMPL +endif +endif + if CUSTOM_ALLOC libutil_a_SOURCES += lib/util/mempool.c include/mempool.h endif -- cgit v1.2.3