Skip to content

Commit

Permalink
Update lib/README.md for mt
Browse files Browse the repository at this point in the history
  • Loading branch information
senhuang42 committed May 6, 2021
1 parent 8dad5e1 commit af17692
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit af17692

Please sign in to comment.