Skip to content

Commit 6528eb5

Browse files
authored
Use POSIX on Windows when building with mingw-w64 toolchain (#1098)
1 parent bdbad1b commit 6528eb5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/mc-mlib/thread.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "./user-check.h"
55

6-
#ifdef _WIN32
6+
#ifdef _MSC_VER
77
#include "./windows-lean.h"
88
#else
99
#include <pthread.h>
@@ -15,7 +15,7 @@
1515
* @brief A status object for @ref mlib_call_once.
1616
*/
1717
typedef struct mlib_once_flag {
18-
#ifdef _WIN32
18+
#ifdef _MSC_VER
1919
INIT_ONCE _native;
2020
#else
2121
pthread_once_t _native;
@@ -27,7 +27,7 @@ typedef struct mlib_once_flag {
2727
* @ref mlib_once_flag object. Can also be used to dynamically initialize or
2828
* "reset" a flag.
2929
*/
30-
#ifdef _WIN32
30+
#ifdef _MSC_VER
3131
#define MLIB_ONCE_INITIALIZER \
3232
{ ._native = INIT_ONCE_STATIC_INIT }
3333
#else
@@ -40,7 +40,7 @@ typedef struct mlib_once_flag {
4040
*/
4141
typedef void (*mlib_init_once_fn_t)(void);
4242

43-
#if defined(_WIN32)
43+
#if defined(_MSC_VER)
4444
/**
4545
* An indirection layer for mlib_once on Windows platforms. Do not use directly.
4646
*/
@@ -68,7 +68,7 @@ static inline BOOL WINAPI _mlib_win32_once_callthru(PINIT_ONCE once, PVOID param
6868
* @return true on success, false otherwise
6969
*/
7070
static inline bool mlib_call_once(mlib_once_flag *flag, mlib_init_once_fn_t fn) {
71-
#ifdef _WIN32
71+
#if defined(_MSC_VER)
7272
bool okay = InitOnceExecuteOnce(&flag->_native, &_mlib_win32_once_callthru, &fn, NULL);
7373
return okay;
7474
#else

0 commit comments

Comments
 (0)