]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Make functable thread-local.
authorMika Lindqvist <postmaster@raasu.org>
Thu, 21 Jun 2018 11:51:06 +0000 (14:51 +0300)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 17 Sep 2018 09:28:28 +0000 (11:28 +0200)
functable.c
functable.h
zbuild.h

index d58ddbd0ada541935a0e4ff3a453075ee6192bac..e0f0e40ce8dae152a090f13efd6280626f0bdc95 100644 (file)
@@ -54,7 +54,7 @@ ZLIB_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, si
 ZLIB_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len);
 
 /* functable init */
-ZLIB_INTERNAL struct functable_s functable = {fill_window_stub,insert_string_stub,adler32_stub,crc32_stub};
+ZLIB_INTERNAL __thread struct functable_s functable = {fill_window_stub,insert_string_stub,adler32_stub,crc32_stub};
 
 
 /* stub functions */
index a8e8b7068432436ce4a31cf7f2b0d6a5641bbe6a..280651c32944ebab055ee6aeb4ac39876d4ecac2 100644 (file)
@@ -15,7 +15,7 @@ struct functable_s {
     uint32_t (* crc32)          (uint32_t crc, const unsigned char *buf, uint64_t len);
 };
 
-ZLIB_INTERNAL extern struct functable_s functable;
+ZLIB_INTERNAL extern __thread struct functable_s functable;
 
 
 #endif
index e2e6fc3e760b4ed195189328182a2017640254fe..f375f2e68b176947ddba8c3e38bc7bafe76bcf3d 100644 (file)
--- a/zbuild.h
+++ b/zbuild.h
@@ -5,6 +5,7 @@
 #if defined(_MSC_VER)
 #  include <windows.h>
    typedef SSIZE_T ssize_t;
+#  define __thread __declspec(thread)
 #endif
 
 #if defined(ZLIB_COMPAT)