changed MT enabling macro to ZSTD_MULTITHREAD
This commit is contained in:
parent
f22adae984
commit
0f984d94c4
@ -11,7 +11,7 @@
|
|||||||
#include <stddef.h> /* size_t */
|
#include <stddef.h> /* size_t */
|
||||||
#include <stdlib.h> /* malloc, calloc, free */
|
#include <stdlib.h> /* malloc, calloc, free */
|
||||||
|
|
||||||
#ifdef ZSTD_PTHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
|
|
||||||
#include <threading.h>
|
#include <threading.h>
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ void POOL_add(void *ctxVoid, POOL_function function, void *opaque) {
|
|||||||
pthread_cond_signal(&ctx->queuePopCond);
|
pthread_cond_signal(&ctx->queuePopCond);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* ZSTD_PTHREAD not defined */
|
#else /* ZSTD_MULTITHREAD not defined */
|
||||||
/* No multi-threading support */
|
/* No multi-threading support */
|
||||||
|
|
||||||
/* We don't need any data, but if it is empty malloc() might return NULL. */
|
/* We don't need any data, but if it is empty malloc() might return NULL. */
|
||||||
@ -183,4 +183,4 @@ void POOL_add(void *ctx, POOL_function function, void *opaque) {
|
|||||||
function(opaque);
|
function(opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ZSTD_PTHREAD */
|
#endif /* ZSTD_MULTITHREAD */
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file will hold wrapper for systems, which do not support Pthreads
|
* This file will hold wrapper for systems, which do not support pthreads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ZSTD_PTHREAD) && defined(_WIN32)
|
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Windows minimalist Pthread Wrapper, based on :
|
* Windows minimalist Pthread Wrapper, based on :
|
||||||
@ -70,4 +70,4 @@ int _pthread_join(pthread_t * thread, void **value_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* ZSTD_MULTITHREAD */
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ZSTD_PTHREAD) && defined(_WIN32)
|
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Windows minimalist Pthread Wrapper, based on :
|
* Windows minimalist Pthread Wrapper, based on :
|
||||||
@ -73,11 +73,11 @@ int _pthread_join(pthread_t* thread, void** value_ptr);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#elif defined(ZSTD_PTHREAD) /* posix assumed ; need a better detection mathod */
|
#elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection mathod */
|
||||||
/* === POSIX Systems === */
|
/* === POSIX Systems === */
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
|
|
||||||
#else /* ZSTD_PTHREAD not defined */
|
#else /* ZSTD_MULTITHREAD not defined */
|
||||||
/* No multithreading support */
|
/* No multithreading support */
|
||||||
|
|
||||||
#define pthread_mutex_t int /* #define rather than typedef, as sometimes pthread support is implicit, resulting in duplicated symbols */
|
#define pthread_mutex_t int /* #define rather than typedef, as sometimes pthread support is implicit, resulting in duplicated symbols */
|
||||||
@ -95,7 +95,7 @@ int _pthread_join(pthread_t* thread, void** value_ptr);
|
|||||||
|
|
||||||
/* do not use pthread_t */
|
/* do not use pthread_t */
|
||||||
|
|
||||||
#endif /* ZSTD_PTHREAD */
|
#endif /* ZSTD_MULTITHREAD */
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ gzstd:
|
|||||||
&& $(MAKE) zstd; \
|
&& $(MAKE) zstd; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zstdmt: CPPFLAGS += -DZSTD_PTHREAD
|
zstdmt: CPPFLAGS += -DZSTD_MULTITHREAD
|
||||||
zstdmt: LDFLAGS += -lpthread
|
zstdmt: LDFLAGS += -lpthread
|
||||||
zstdmt: zstd
|
zstdmt: zstd
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@ ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c
|
|||||||
# Define *.exe as extension for Windows systems
|
# Define *.exe as extension for Windows systems
|
||||||
ifneq (,$(filter Windows%,$(OS)))
|
ifneq (,$(filter Windows%,$(OS)))
|
||||||
EXT =.exe
|
EXT =.exe
|
||||||
PTHREAD = -DZSTD_PTHREAD
|
MULTITHREAD = -DZSTD_MULTITHREAD
|
||||||
else
|
else
|
||||||
EXT =
|
EXT =
|
||||||
PTHREAD = -pthread -DZSTD_PTHREAD
|
MULTITHREAD = -pthread -DZSTD_MULTITHREAD
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VOID = /dev/null
|
VOID = /dev/null
|
||||||
@ -122,10 +122,10 @@ zbufftest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c zbufftest.c
|
|||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@$(EXT)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@$(EXT)
|
||||||
|
|
||||||
zstreamtest : $(ZSTD_FILES) $(PRGDIR)/datagen.c zstreamtest.c
|
zstreamtest : $(ZSTD_FILES) $(PRGDIR)/datagen.c zstreamtest.c
|
||||||
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
$(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||||
|
|
||||||
zstreamtest32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c zstreamtest.c
|
zstreamtest32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c zstreamtest.c
|
||||||
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT)
|
$(CC) -m32 $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||||
|
|
||||||
zstreamtest-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
|
zstreamtest-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
|
||||||
zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c zstreamtest.c
|
zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c zstreamtest.c
|
||||||
@ -157,7 +157,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
pool : pool.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c
|
pool : pool.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c
|
||||||
$(CC) $(FLAGS) $(PTHREAD) $^ -o $@$(EXT)
|
$(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||||
|
|
||||||
namespaceTest:
|
namespaceTest:
|
||||||
if $(CC) namespaceTest.c ../lib/common/xxhash.c -o $@ ; then echo compilation should fail; exit 1 ; fi
|
if $(CC) namespaceTest.c ../lib/common/xxhash.c -o $@ ; then echo compilation should fail; exit 1 ; fi
|
||||||
|
Loading…
Reference in New Issue
Block a user