You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bill Stoddard <bi...@wstoddard.com> on 2002/10/20 03:33:45 UTC

[PATCH] Win32: Why explicitly futz with the file pointer?

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;


Re: [PATCH] Win32: Why explicitly futz with the file pointer?

Posted by "William A. Rowe, Jr." <wr...@apache.org>.
At 08:33 PM 10/19/2002, Bill Stoddard wrote:
>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()

The code predates my involvement in apr, however...

don't you suppose the question belongs in the dev@apr list?