diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-20 10:46:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-20 10:46:24 +0100 |
commit | 4f444cc815486ac67f62470685103a067b2ef019 (patch) | |
tree | ba70c23272a600a21304303d423da3688c55b8b0 /thirdparty/pcre2/src/sljit/sljitUtils.c | |
parent | 3924aa6e8f51ba8be3b40c0a0777252ad6f29c0c (diff) | |
parent | 914b7f825d9b4bd2653cdd5a43e84f5843eedb20 (diff) |
Merge pull request #55120 from akien-mga/pcre2-10.39
Diffstat (limited to 'thirdparty/pcre2/src/sljit/sljitUtils.c')
-rw-r--r-- | thirdparty/pcre2/src/sljit/sljitUtils.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/thirdparty/pcre2/src/sljit/sljitUtils.c b/thirdparty/pcre2/src/sljit/sljitUtils.c index 08ca35cf37..9bce714735 100644 --- a/thirdparty/pcre2/src/sljit/sljitUtils.c +++ b/thirdparty/pcre2/src/sljit/sljitUtils.c @@ -48,7 +48,7 @@ static HANDLE allocator_lock; static SLJIT_INLINE void allocator_grab_lock(void) { HANDLE lock; - if (SLJIT_UNLIKELY(!allocator_lock)) { + if (SLJIT_UNLIKELY(!InterlockedCompareExchangePointer(&allocator_lock, NULL, NULL))) { lock = CreateMutex(NULL, FALSE, NULL); if (InterlockedCompareExchangePointer(&allocator_lock, lock, NULL)) CloseHandle(lock); @@ -146,9 +146,13 @@ static SLJIT_INLINE sljit_sw get_page_alignment(void) { #include <unistd.h> static SLJIT_INLINE sljit_sw get_page_alignment(void) { - static sljit_sw sljit_page_align; - if (!sljit_page_align) { + static sljit_sw sljit_page_align = -1; + if (sljit_page_align < 0) { +#ifdef _SC_PAGESIZE sljit_page_align = sysconf(_SC_PAGESIZE); +#else + sljit_page_align = getpagesize(); +#endif /* Should never happen. */ if (sljit_page_align < 0) sljit_page_align = 4096; |