From af1769258070e1aa00e1618d035a0f8590e7e55a Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Thu, 6 May 2021 13:42:50 -0700 Subject: [PATCH] Update lib/README.md for mt --- lib/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/README.md b/lib/README.md index db9170a75c4..d144e5f7cc7 100644 --- a/lib/README.md +++ b/lib/README.md @@ -19,12 +19,16 @@ The scope can be reduced on demand (see paragraph _modular build_). #### Multithreading support -Multithreading is disabled by default when building with `make`. +When building with `make`, by default the dynamic library is multithreaded and static library is single-threaded (for compatibility reasons). + Enabling multithreading requires 2 conditions : - set build macro `ZSTD_MULTITHREAD` (`-DZSTD_MULTITHREAD` for `gcc`) - for POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc`) -Both conditions are automatically applied when invoking `make lib-mt` target. +For convenience, we provide a build target to generate multi and single threaded libraries: +- Force enable multithreading on both dynamic and static libraries by appending `-mt` to the target, e.g. `make lib-mt`. +- Force disable multithreading on both dynamic and static libraries by appending `-nomt` to the target, e.g. `make lib-nomt`. +- By default, as mentioned before, dynamic library is multithreaded, and static library is single-threaded, e.g. `make lib`. When linking a POSIX program with a multithreaded version of `libzstd`, note that it's necessary to invoke the `-pthread` flag during link stage.