diff --git a/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp b/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp index c52fea3865fa443dcd537d1170a5fd199f787772..985927bb230d6ee25e64aba6c3f544816da07080 100644 --- a/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp +++ b/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -38,9 +39,12 @@ static int SIX = 6; static int EIGHT = 8; static int GARBAGE_LEN = strlen(GARBAGE); static unsigned BUFFER_SIZE = 8192; +std::mutex gzMutex_; +std::mutex puMutex_; static unsigned pull(void *desc, unsigned char **buf) { + std::lock_guard lock(puMutex_); static unsigned int next = 0; static unsigned char dat[] = {0x63, 0, 2, 0}; @@ -53,12 +57,14 @@ static unsigned pull(void *desc, unsigned char **buf) static int push(void *desc, unsigned char *buf, unsigned len) { + std::lock_guard lock(puMutex_); buf += len; return desc != nullptr; /* force error if desc not null */ } static int TestGzPrintf(gzFile file, const char *format, ...) { + std::lock_guard lock(gzMutex_); va_list va; int ret;