diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2014-06-18 22:07:06 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2014-06-18 22:07:06 +0300 |
commit | 96864a6ddf91ad693d102ea165f3d7918744d582 (patch) | |
tree | 2c92257bac56733c76633227de691d346b987984 /src/xz | |
parent | liblzma: Add lzma_cputhreads(). (diff) | |
download | xz-96864a6ddf91ad693d102ea165f3d7918744d582.tar.xz |
xz: Use lzma_cputhreads() instead of own copy of tuklib_cpucores().
Diffstat (limited to '')
-rw-r--r-- | src/xz/Makefile.am | 1 | ||||
-rw-r--r-- | src/xz/hardware.c | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/xz/Makefile.am b/src/xz/Makefile.am index 3d3154ed..088319b3 100644 --- a/src/xz/Makefile.am +++ b/src/xz/Makefile.am @@ -36,7 +36,6 @@ xz_SOURCES = \ $(top_srcdir)/src/common/tuklib_open_stdxxx.c \ $(top_srcdir)/src/common/tuklib_progname.c \ $(top_srcdir)/src/common/tuklib_exit.c \ - $(top_srcdir)/src/common/tuklib_cpucores.c \ $(top_srcdir)/src/common/tuklib_mbstr_width.c \ $(top_srcdir)/src/common/tuklib_mbstr_fw.c diff --git a/src/xz/hardware.c b/src/xz/hardware.c index 925926ca..ff32f6d3 100644 --- a/src/xz/hardware.c +++ b/src/xz/hardware.c @@ -11,7 +11,6 @@ /////////////////////////////////////////////////////////////////////////////// #include "private.h" -#include "tuklib_cpucores.h" /// Maximum number of worker threads. This can be set with @@ -33,10 +32,17 @@ hardware_threads_set(uint32_t n) { if (n == 0) { // Automatic number of threads was requested. - // Use the number of available CPU cores. - threads_max = tuklib_cpucores(); + // If threading support was enabled at build time, + // use the number of available CPU cores. Otherwise + // use one thread since disabling threading support + // omits lzma_cputhreads() from liblzma. +#ifdef MYTHREAD_ENABLED + threads_max = lzma_cputhreads(); if (threads_max == 0) threads_max = 1; +#else + threads_max = 1; +#endif } else { threads_max = n; } |