apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject [PATCH] Win32: Why explicitly futz with the file pointer?
Date Sun, 20 Oct 2002 12:08:36 GMT
Why do we need to call SetFilePointer to each call of apr_file_write()? In
the common case where only threads in a single process write to a file,
calling SetFilePointer is a waste of cycles. If threads from multiple
processes are writing to a file, then we are broken unless the application
explicitly serializes access to apr_file_write()

Index: readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v
retrieving revision 1.69
diff -u -r1.69 readwrite.c
--- readwrite.c	15 Jul 2002 07:24:34 -0000	1.69
+++ readwrite.c	20 Oct 2002 01:28:57 -0000
@@ -307,9 +307,6 @@
             thefile->pOverlapped->Offset     = (DWORD)thefile->filePtr;
             thefile->pOverlapped->OffsetHigh = (DWORD)(thefile->filePtr >>
32);
         }
-        else if (!thefile->pipe && thefile->append) {
-            SetFilePointer(thefile->filehand, 0, NULL, FILE_END);
-        }
         if (WriteFile(thefile->filehand, buf, *nbytes, &bwrote,
                       thefile->pOverlapped)) {
             *nbytes = bwrote;


Mime
View raw message