1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

xz: Use lzma_cputhreads() instead of own copy of tuklib_cpucores().

This commit is contained in:
Lasse Collin 2014-06-18 22:07:06 +03:00
parent a115cc3748
commit 96864a6ddf
2 changed files with 9 additions and 4 deletions

View file

@ -36,7 +36,6 @@ xz_SOURCES = \
$(top_srcdir)/src/common/tuklib_open_stdxxx.c \ $(top_srcdir)/src/common/tuklib_open_stdxxx.c \
$(top_srcdir)/src/common/tuklib_progname.c \ $(top_srcdir)/src/common/tuklib_progname.c \
$(top_srcdir)/src/common/tuklib_exit.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_width.c \
$(top_srcdir)/src/common/tuklib_mbstr_fw.c $(top_srcdir)/src/common/tuklib_mbstr_fw.c

View file

@ -11,7 +11,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "private.h" #include "private.h"
#include "tuklib_cpucores.h"
/// Maximum number of worker threads. This can be set with /// Maximum number of worker threads. This can be set with
@ -33,10 +32,17 @@ hardware_threads_set(uint32_t n)
{ {
if (n == 0) { if (n == 0) {
// Automatic number of threads was requested. // Automatic number of threads was requested.
// Use the number of available CPU cores. // If threading support was enabled at build time,
threads_max = tuklib_cpucores(); // 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) if (threads_max == 0)
threads_max = 1; threads_max = 1;
#else
threads_max = 1;
#endif
} else { } else {
threads_max = n; threads_max = n;
} }