From ca6fae78080d0a532ce90be830584212c7350fc2 Mon Sep 17 00:00:00 2001 From: Sean Purcell Date: Tue, 18 Apr 2017 14:13:01 -0700 Subject: [PATCH 1/2] Add MT enabled targets for libzstd --- lib/Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 197fdeeea..d8d8e179d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -71,6 +71,9 @@ libzstd.a: $(ZSTD_OBJ) @echo compiling static library @$(AR) $(ARFLAGS) $@ $^ +libzstd.a-mt: CPPFLAGS += -DZSTD_MULTHREAD +libzstd.a-mt: libzstd.a + $(LIBZSTD): LDFLAGS += -shared -fPIC -fvisibility=hidden $(LIBZSTD): $(ZSTD_FILES) @echo compiling dynamic library $(LIBVER) @@ -86,10 +89,17 @@ endif libzstd : $(LIBZSTD) +libzstd-mt : CPPFLAGS += -DZSTD_MULTITHREAD +libzstd-mt : libzstd + lib: libzstd.a libzstd -lib-release: DEBUGFLAGS := +lib-mt: CPPFLAGS += -DZSTD_MULTITHREAD +lib-mt: lib + +lib-release lib-release-mt: DEBUGFLAGS := lib-release: lib +lib-release-mt: lib-mt clean: @$(RM) -r *.dSYM # Mac OS-X specific From 98cf7fcb2ab311dc40a616cd15774813e1e8517d Mon Sep 17 00:00:00 2001 From: Sean Purcell Date: Tue, 18 Apr 2017 17:03:37 -0700 Subject: [PATCH 2/2] Update README --- lib/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/README.md b/lib/README.md index 3357e3d87..8fa60a20f 100644 --- a/lib/README.md +++ b/lib/README.md @@ -22,6 +22,14 @@ Some additional API may be useful if you're looking into advanced features : They are not "stable", their definition may change in the future. Only static linking is allowed. +#### ZSTDMT API + +To enable building the multithreaded compression API, use the `make lib-mt` target. +The header file zstdmt_compress.h (in compress/) provides the prototypes for the API. +If linking a program that uses the ZSTDMT API against libzstd.a on a POSIX system, +the -pthread flag must be provided to the compiler at link time. +Note that these prototypes may still be used in a version built without multithread support, +but they will be single threaded (i.e. no benefits will be given over the standard ZSTD API). #### Modular build