diff options
-rw-r--r-- | win32/win32.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 2bf1bb1dbc..f8de990bad 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1558,11 +1558,15 @@ EXTERN_C void __cdecl _lock_fhandle(int); EXTERN_C void __cdecl _unlock_fhandle(int); EXTERN_C void __cdecl _unlock(int); +#if defined _MT || defined __MSVCRT__ +#define MSVCRT_THREADS +#endif + typedef struct { long osfhnd; /* underlying OS file HANDLE */ char osfile; /* attributes of file (e.g., open in text mode?) */ char pipech; /* one char buffer for handles opened on pipes */ -#ifdef _MT +#ifdef MSVCRT_THREADS int lockinitflag; CRITICAL_SECTION lock; #endif @@ -1598,7 +1602,7 @@ _alloc_osfhnd(void) CloseHandle(hF); if (fh == -1) return fh; -#ifdef _MT +#ifdef MSVCRT_THREADS EnterCriticalSection(&(_pioinfo(fh)->lock)); #endif return fh; @@ -1635,7 +1639,7 @@ my_open_osfhandle(long osfhandle, int flags) fileflags |= FOPEN; /* mark as open */ _osfile(fh) = fileflags; /* set osfile entry */ -#ifdef _MT +#ifdef MSVCRT_THREADS LeaveCriticalSection(&_pioinfo(fh)->lock); #endif |