]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Windows: Fix mythread_once() macro with Vista threads.
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 31 Oct 2022 11:31:58 +0000 (13:31 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2022 11:41:43 +0000 (13:41 +0200)
Don't call InitOnceComplete() if initialization was already done.

So far mythread_once() has been needed only when building
with --enable-small. windows/build.bash does this together
with --disable-threads so the Vista-specific mythread_once()
is never needed by those builds. VS project files or
CMake-builds don't support HAVE_SMALL builds at all.

src/common/mythread.h

index be22654240aa592728b17b7bc775eda912610cf7..413821836020f4b7bec5a873bab2d24ed71f517b 100644 (file)
@@ -370,10 +370,11 @@ typedef struct {
                BOOL pending_; \
                if (!InitOnceBeginInitialize(&once_, 0, &pending_, NULL)) \
                        abort(); \
-               if (pending_) \
+               if (pending_) \
                        func(); \
-               if (!InitOnceComplete(&once, 0, NULL)) \
-                       abort(); \
+                       if (!InitOnceComplete(&once, 0, NULL)) \
+                               abort(); \
+               } \
        } while (0)
 #endif