git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2000-09-18 09:54:47 +00:00
parent 4378cbc023
commit e1461461cc
1 changed files with 7 additions and 3 deletions

View File

@ -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