bjh 99/11/06 22:58:52
Modified: src/lib/apr/file_io/os2 readwrite.c Log: OS/2: make ap_read/ap_write thread safe when buffered. Revision Changes Path 1.8 +6 -0 apache-2.0/src/lib/apr/file_io/os2/readwrite.c Index: readwrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/readwrite.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- readwrite.c 1999/11/05 21:16:16 1.7 +++ readwrite.c 1999/11/07 06:58:50 1.8 @@ -75,6 +75,8 @@ ULONG blocksize; ULONG size = *nbytes; + DosEnterCritSec(); + if (thefile->direction == 1) { ap_flush(thefile); thefile->bufpos = 0; @@ -102,6 +104,7 @@ } *nbytes = rc == 0 ? pos - (char *)buf : 0; + DosExitCritSec(); return os2errno(rc); } else { rc = DosRead(thefile->filedes, buf, *nbytes, &bytesread); @@ -139,6 +142,8 @@ int blocksize; int size = *nbytes; + DosEnterCritSec(); + if ( thefile->direction == 0 ) { // Position file pointer for writing at the offset we are logically reading from ULONG offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; @@ -159,6 +164,7 @@ size -= blocksize; } + DosExitCritSec(); return os2errno(rc); } else { rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);