summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-18 09:54:47 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-18 09:54:47 +0000
commite1461461ccfc66d37bbc4823d44bb9e2b7d879ae (patch)
treea8a8c2eff3bd67dc4c167a91443398727236f780
parent4378cbc0235e20ccee5ecb7d8a0e3b95c418e43d (diff)
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--win32/win32.c10
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