From: Lasse Collin Date: Mon, 31 Oct 2022 11:31:58 +0000 (+0200) Subject: Windows: Fix mythread_once() macro with Vista threads. X-Git-Tag: v5.2.8~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6930f14733757592a4f8d92513f642a5dcc9ec9c;p=thirdparty%2Fxz.git Windows: Fix mythread_once() macro with Vista threads. 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. --- diff --git a/src/common/mythread.h b/src/common/mythread.h index be226542..41382183 100644 --- a/src/common/mythread.h +++ b/src/common/mythread.h @@ -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